I'm looping through a directory of files in Cordova 3.1.0. For each entry I want the filename and the modification date.
I'm using the getMetadata method on the FileEntry object, which returns the Metadata object in the success callback but I can't see anyway to tie that Metadata object back to the FileEntry object.
This means I have an array of filenames and an array of modification dates but no link between the two.
Here's my code snippet:
// DirectoryEntry.getDirectory callback
function gotPagesDir(d)
{
var reader = d.createReader();
reader.readEntries(function(d){
gotFiles(d);
appReady();
}, onError);
}
function gotFiles(entries)
{
for(var i in entries)
{
// __CACHED_FILES is a global scoped object
__CACHED_FILES[entries[i].name] = {name: entries[i].name};
entries[i].getMetadata(gotMetadata, metadataError);
}
}
function gotMetadata(metadata)
{
var date_modified = metadata.modificationTime;
// How do I workout which FileEntry object this metadata object belongs to?
}