This is the class that I have created for reading/writing/removing:
var app_file = {
fileSystem: null,
init: function() {
window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, app_file.gotFS, app_file.fail);
},
gotFS: function(fileSystem) {
app_file.fileSystem = fileSystem;
},
viewLog: function() {
directoryEntry = app_file.fileSystem.root;
var directoryReader = directoryEntry.createReader();
directoryReader.readEntries(app_file.readDirectory, app_file.fail);
},
readDirectory: function(entries){
var sOutput = "";
for(var i=0; i < entries.length; i++) {
console.log(entries[i].name);
entries[i].remove(function(){
console.log("File removed");
},function(){
console.log("error deleting the file " + error.code);
});
}
},
fail: function(error) {
console.log('app_file error: ' + error.code);
}
};
every time I execute viewLog method, I get a list of all the files and a console message "File removed", but actually files are never removed, because files are always listed when the method is called.
Any suggestion?