Im running this simple code when the device ready is fired:
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fs){
var imagesRootPath = fs.root.fullPath;
navigator.notification.alert(imagesRootPath);
},
function(evt) { navigator.notification.alert(evt.target.error.code)});
In a MAC pro with Phonegap 3.2 this works perfectly, when it code is running in the simulator, the imagesRootPath is a long string path. When I run this code deployed in a Ipod device, I get other different long path.
Now, when I run this code in a NOTEBOOK that has the same MacOS than the Mac Pro, but has Phonegap 3.3, I get in the simulator only "/" (slash) path and the same slash in when I deploy the Phonegap app on the device.
I made the proper plugin configuration for file API.
What may be wrong?
Thanks!
In current plugin dev branch there is a solution:
Entry.toNativeURL() - Returns the full path to the file in the device FileSystem.
https://github.com/apache/cordova-plugin-file/tree/dev
The latest release of Cordova changed the way the File plugin works with paths significantly. What you're seeing is actually the expected behaviour of the File plugin if you use the earlier documentation. (I was having the exact same problem with my older code).
http://cordova.apache.org/news/2014/02/10/plugins-release.html https://github.com/apache/cordova-plugin-file/blob/dev/doc/index.md - check out the upgrade notes.
It's a shame this question was down voted because of its confusing explanation. I am having the same problem: fileEntry.fullPath
returns '/fileName' instead of the actual file path. I see this behavior in versions 3.1 and 3.2 of phonegap as well.
Just so it's clear, by actual file path I mean something like: /Users/user/Library/Application Support/.../.../.../fileName'
According to the doc:
If your application works with device-absolute-paths, and you previously retrieved those paths through the
fullPath
property ofEntry
objects, then you should update your code to useentry.toURL()
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With