Trying to get debugging and run it smoothly. Currently, I can test the FileSystem API by starting my device, but this is a painful process. I tried to configure the Chrome file system API using the code I found here on SO. I get a return to the file system (although it is not called "and fullPath =" / "). I get a request from Chrome that the application wants to save locally, and I accept it. But the creation of the directory is interrupted every time. Code for the device (only difference is a request for the local file system).
Any thoughts? I would really like you to be able to debug Ripple as a first step before moving on to the device.
navigator.webkitPersistentStorage.requestQuota(1024*1024, function(grantedBytes) {
window.webkitRequestFileSystem(PERSISTENT, grantedBytes, onFileSystemSuccess, onFileSystemFail);
}, function(e) {
console.log('Error', e);
});
function onFileSystemSuccess(fileSystem) {
console.log(fileSystem.name);
console.log(fileSystem.root.name);
var storageDir = fileSystem.root
console.log(storageDir, storageDir.fullPath);
function getDirSuccess(dirEntry) {
console.log("Directory Name: " + dirEntry.name);
alert("Your files are stored in: " + dirEntry.name);
dirEntry.getFile("readme.txt", {create: true, exclusive: false}, gotFileEntry, fail);
function gotFileEntry(fileEntry) {
fileEntry.createWriter(gotFileWriter, fail);
}
function gotFileWriter(writer) {
writer.onwriteend = function(evt) {
console.log("contents of file now 'some sample text'");
writer.truncate(11);
writer.onwriteend = function(evt) {
console.log("contents of file now 'some sample'");
writer.seek(4);
writer.write(" different text");
writer.onwriteend = function(evt){
console.log("contents of file now 'some different text'");
}
};
};
writer.write("some sample text");
alert('wrote a text file');
}
function fail(error) {
console.log(error.code);
}