Good work. APIs need better names/signatures I think. Will see what I come up with.
Sent from my iPhone > On May 6, 2014, at 7:06 AM, Andrew Grieve <agri...@chromium.org> wrote: > > Closer than ever to resolving this (woo!) > > The file plugin is now able to read & write to roots on the filesystem > beyond PERSISTENT and TEMPORARY on iOS, Android, and BlackBerry (and maybe > others?) > > However, you still can't query for the location of these places (doh!) > > There's a file-extras plugin in cordova-labs: > https://git-wip-us.apache.org/repos/asf?p=cordova-labs.git;a=blob;f=file-extras/fileextras.js;h=1f8f88f7222bd4022f2f802f6825c189b10445d9;hb=aaf61d4 > > That was used to experiment with an API for this. I think the API is pretty > much fine, and I'd like to add it to the core file plugin rather than have > it as a separate plugin. > > This would add: > cordova.plugins.file.getDirectoryForPurpose(purpose, options, win, fail) > > Where purpose can be one of: > var Purpose = { > 'data': 0, // General application data (default) > 'documents': 1, // Files that are meaningful to other applciations > (e.g. Office files) > 'cache': 2, // Temporary files that should survive app restarts > 'temp': 3, // Files that can should be deleted on app restarts > 'app-bundle': 4 // The application bundle (iOS only) > } > > And also add convenience wrappers: > cordova.plugins.file.getDataDirectory(syncable, win) > cordova.plugins.file.getDocumentsDirectory(win) > cordova.plugins.file.getTempDirectory(win) > cordova.plugins.file.getCacheDirectory(win) > > > Any comments on this?