cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Rumsey <arum...@adobe.com>
Subject [file plugin] Accessing physical device paths
Date Fri, 28 Feb 2014 16:22:44 GMT
Hi there Cordova devs!

The release of version 1.0 of the file plugin obviously changed the
behaviour of a majority of its API in order to be better aligned with the
W3C file spec.  As an app developer at Adobe and user of this plugin the
abstraction of device paths to filesystem URLs is great in order to get
consistent behaviour across devices.  On the other hand there are cases
when a lament the loss of having access to actual device paths.  Is it not
possible to to have the best opt both worlds and allow the file plugin to
convert file entry URLs to local paths when desired?

Wait a second! There is an internal method already that provides
thisÅ "_getLocalFilesystemPath"!!

I know there has been lengthy discussion on this topic in the past but
what was the final reason for hiding this functionality?

Now for some context on my use case.

In the process of upgrading an app I'm working on to use file-plugin 1.0 I
ran across 2 cases where I needed an actual local filesystem path.  First,
the app downloads ZIP files from a server and then unzips them on the
device to persistent storage. The zip plugin in this case expects local
file system paths as its source and destination.  Maybe the solution to
this usage would be for the zip plugin to support filesystem URLs.  Fair
enough but that isn't the case today.  Second, once the zip content is
stored I then want to redirect my web view to that location.  With the
testing I did there didn't seem to be a way to redirect to a filesystem
URL using 'window.location.href'.

In both cases, since '_getLocalFilesystemPath' exists, I have resorted to
calling 'window.cordova.exec(success, fail, "File",
"_getLocalFilesystemPath", [url]);' in order to get the desired path.

Thanks,
Anthony


Mime
View raw message