getDirectory gives FileError.PATH_EXISTS_ERR when opening existing directory even-though I pass exclusive: false

1,657 views
Skip to first unread message

Gavriel Fleischer

unread,
May 16, 2012, 4:55:04 PM5/16/12
to phon...@googlegroups.com
I'm running my code on Android 2.3.7 via build.phonegap.com (phonegap 1.6.1) and I get FileError.PATH_EXISTS_ERR every time when I try to open my app's main directory that already exsists: 

function onGotPermFileSystem(fileSystem) {
    fileSystem.root.getDirectory("com.example.myapp", {create: true, exclusive: false}, func1, func2);
}
window.requestFileSystem(LocalFileSystem.PERSISTENT, 10*1024*1024, onGotPermFileSystem);

Gavriel Fleischer

unread,
May 16, 2012, 5:35:14 PM5/16/12
to phon...@googlegroups.com
Actually the directory was non-existant! When I created the directory (with the same app that I compiled in Eclipse, not through build.phonegap.com) it could create the directory, and in both builds it gets to the existing directory. So the real problem is: build.phonegap.com's build can't create the directory. Maybe it's because in Eclipse I compiled it with cordoba 1.7.2 and in phongap.com they use 1.6.1? What else can be different?

Gavriel Fleischer

unread,
May 16, 2012, 7:18:29 PM5/16/12
to phon...@googlegroups.com
adding to config.xml: 
 fixed it

Nahwin Rajan

unread,
Apr 15, 2014, 5:26:43 AM4/15/14
to phon...@googlegroups.com
config.xml ??

I'm currently encountereing this error and kind of making me banging my heads against the wall.
As first of all the phonegap documentation says that getDirectory is supposed to return the directory, if it does not exist it will create it (assuming we are using the options as {create: true, exclusive: false} ) yet why in the earth it can give error of path exist ?? what the freaking connection if it exist than just return that why would it become an error ??

Nahwin Rajan

unread,
Apr 15, 2014, 7:29:39 AM4/15/14
to phon...@googlegroups.com
Found the culprit ,

Turn out that getDirectory will throw error if
The immediate parent folder does not exist.

This explains why all those code snippet of getDirectory with one directpry and
Straight fromthe filesystem always works.

But the next question is:
I was doing :

DirectoryEntry.getDirectory("Android/data/[mypackagename/desiredfolder', 
 {create: true, exclusive: false}, succCallback, failCallBack);

How can the parent folder does not exist as that is my package installaiin folder?

Regards,

Nahwin R

Sent from my iPhone
--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
---
You received this message because you are subscribed to a topic in the Google Groups "phonegap" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/phonegap/CUJO1qLZK0g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to phonegap+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Trent Hennessy

unread,
May 26, 2014, 8:18:54 PM5/26/14
to phon...@googlegroups.com
This is been happening to me since upgrading to phonegap 3.4 with the latest file plugin v1.1.0. On initial start up of the app it checks for files to update, however, now it can't access the local storage for this.

At another point in the app, I can access "DCIM/camera" without issue.

If I try using the same "DCIM/camera" location instead of my update files location on start up, I still get the same error.

Not sure how it can work in one place, and not in another.
Reply all
Reply to author
Forward
0 new messages