cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ray Camden <>
Subject Questions about FileSystem documentation and paths
Date Sun, 29 Jun 2014 17:04:08 GMT
Hey folks - I originally raised this on the Google Group as I assumed it was just an issue
w/ my code, but I believe this is a documentation issue so I'm raising it here. If wrong,
let me know. :)

I'm working on a set of of demos related to the FileSystem feature to answer a series of FAQs
risen on my blog. For my first sample app, I wanted to build something simple:

Check for a file on the device. 
If not there, fetch it.

Looking at the docs for the FileSystem important dirs, I assumed that cordova.file.applicationStorageDirectory
made the most sense. The docs say it is: "Root of app's private writable storage."

Note the words private and writable. In my mind that was: "I can write to it and it is private,
no other app can use it."

But in my testing when I tried to FileTransfer crap down to it, I always got this error: 
"Could not create target file"

Not really sure what to do, I eventually tried cordova.file.dataDirectory. According to the
docs for it, it is: "Where to put app-specific data files." Since it didn't say Private, my
understanding was: "Ok, I can put crap here too, but it is public, so other apps can see it."

Switching to this made my app work immediately. (Haven't tested Android yet.)

So my question is - did I simply misunderstand the documentation for applicationStorageDirectory?
If so, if someone can help explain what I did wrong, I'll happily write it up in a PR to improve
the doc.

If I didn't misunderstand it and there is a bug, I'll file a report. 

If you want to see the entire app (again, it is incredibly simple), you can see it here:
View raw message