The userFolder is guaranteed to be writable on all platforms, so can try with it?
Even if I use the example from the documentation, it wont work (this uses the userFolder)
#Download a file to the specified filename.
downloadfileProps = Hash.new
downloadfileProps["filename"] = Rho::Application.publicFolder+"/images/sample.png"
downloadfileProps["overwriteFile"] = true
Rho::Network.downloadFile(downloadfileProps, url_for(:action => :download_file_callback))
I can try on some other devices soon..
Try to use Rho::RhoFile.join as shown below,
downloadfileProps["filename"] = Rho::RhoFile.join(Rho::Application.userFolder, "sample.png")
because different platforms have different conventions. For example,Windows uses \ to separate paths, while all other platforms use / .
I do use the RhoFile.join in my own code.. but still get the error:
pullFile: cannot create file :/var/mobile/Applications/..../Library/Caches/Private Documents/apps/public/images/provider/itunes.jpg.rhodownload
Jochem, Please use Rho::Application.userFolder instead of Rho::Application.publicFolder . We have sent a fix for the example in the documentation. Thanks, Javier Kutir Mobility
I have a JSON file in public that needs to be updated.
After reading this, my procedure is as following:
- copy JSON file from publicFolder to userFolder on the initial start of the app
- seed JSON file always from writable userFolder
- download update JSON file to userFolder
Is this first copy operation necessary or is there a better way to do this and perhaps only have a single location where the file is placed?
Is that possible to download the file directly to /Libraries/Cache folder????