I am getting an error when I try to create a file in the documents directory on my android phone
the code:
-------------------
local path = system.pathForFile(fileName, system.DocumentsDirectory)
local myFile, errors = io.open( fileName, "w" )
-----------------
I am using "myFile.txt" for the fileName
the error returned was "read-only file system"
I got the same error when I tried the using system.TemporaryDirectory
Do I need specific permissions set for this?
I was helping someone who had a very similar problem. The app ran fine on the iOS devices but on Android it would download the content from the server. He ended up using system.TemporaryDirectory and got it working. But he was getting a permission problem writing to system.DocumentsDirectory and system.CachesDirectory.
It would be nice to know the answer to this....
Rob
if it is regarding permission add this
android.permission.WRITE_EXTERNAL_STORAGE
http://developer.anscamobile.com/content/configuring-projects#Orientation_Support_Android
i cant test it as it is a lot to test but it is suppose to work
:)
I saw that. I know many people keep their apps on their external storage, but I was gathering that permission to mean the ability to write files outside the app sandbox onto external storage, like saving a PDF file so that it could be read on another device. But I guess it's worth trying.
Someday I'll be android friendly.
Thanks
Thanks for the help, but it actually turned out to be a very obvious error in my code.
above, notice how I am passing filename into io.open
and not path....