I create another post but I didn’t wrote exactly the proper code and what the problem is.
So here the full code.
I declare “myarray” in the create function. I push the values in my success function to the array and return in the create create function.
The problem is that I don’t get any values back when call the create function. I think it’s something the scope om my array but I don’t know exactly how I can resolve this.
function Create(targetdir)
{
var myarray = new Array();
//Get a list of file names in the directory
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onSuccess, onError);
function onSuccess(fileSystem)
{
var entry=fileSystem.root;
entry.getDirectory(targetdir, {create: false, exclusive: false}, successdir, fail);
//filesystem2 is the target dir
function successdir(fileSystem2)
{
var directoryReader = fileSystem2.createReader();
directoryReader.readEntries(success, fail);
function success(entries)
{
var i;
for (i=0; i<entries.length; i++)
{
myarray.push(entries[i].toURI());
}
}
}
}
return myarray;
}
Use a callback:
Then: