I know that this thing was already questioned, but really, I have not found anything useful or understandable.
I have this code:
var pdfListPath = [];
function listDir(path) {
window.resolveLocalFileSystemURL(path,
function(fileSystem) {
var reader = fileSystem.createReader();
reader.readEntries(
function(entries) {
console.log(entries);
for (var i = 0; i == entries.length; i++) {
pdfListPath.push(entries[i]);
};
},
function(err) {
console.log(err)
}
);
},
function(err) {
console.log(err);
}
);
};
var pdfList = listDir(cordova.file.applicationDirectory + "www/pdf/");
console.log(pdfList);
console.log(pdfListPath);
What I expected was the pdfListPath
filled with something, but what I get in the console is an "undefined."
The entries
instead is a filled array, so what is wrong with this?
Thank you in advance.