Question

I want to write a file or get a directory from absolute path in Phonegap, in 'File' API of PhoneGap has written

getDirectory

Creates or looks up an existing directory. An error results if the app attempts to:

create a directory whose immediate parent does not yet exist. Parameters:

path: The path to the directory to be looked up or created. Either an absolute path, or a >relative path from this DirectoryEntry. (DOMString)

But when a execute with absolute path , call back error function with error.code = 5 I tried with only directory, success.

Can you explain for me about it.

Was it helpful?

Solution

Check whether your absolute path has // uri prepended. So your code will look like

window.resolveLocalFileSystemURI("//" + yourpath, onSuccess, onFail);

by prepending to the URI // it looks in the correct path.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top