ahh, the application directory is read only. so, i'm assuming that goes for any child directories as well? The file I'm trying to read-write to is a file I've included in the packaging of the application. It's not in the same directory as the application, but one folder down, in a folder call "security". I must be assuming correctly that these are read only as well, and that I should be using applicationStorageDirectory instead?
That'll work, but sucks because being able to include a default file saves time coding since I don't have to write the logic to check if it exists first, then create if doesn't, and so on.
You should not write the application directory.
As I expected. Thanks Ted.
I am trying to do the same thing. I see now that is it read-only. However, when an AIR application is uninstalled the applicationStorageDirectory is not cleared or removed. I am trying to create a screen that thanks the user upon install, meaning when the app is uninstalled I would need to clear out the memory of it ever being installed. The applicationDirectory is removed, but it isn't writable. HMM, any suggestions guys?
The solution is to use a line like
myFile = new File(pathAsString);
so use the File(path) constructor. Then you will be able to write files in the application directory. Solution found at http://exaflood.de/syrotech/air-securityerror-filewriteresource/.
This does not seem to be working in AIR 2. Can anyone else confirm this?
Is it possible to get some sample code describing the problem you're running into? What platforms are you having issues with?
Moved discussion to the Problems and bugs forum.
It works fine.
Hi, this is how I solved/hacked the problem.
var filePath:String = "app:/" + FileNames.DATA_COMMENTS_DIR + "/" + fileName;var appDirFile:File = new File(filePath);var xmlFile:File = new File(appDirFile.nativePath);var fileStream:FileStream = new FileStream();fileStream.open(xmlFile, FileMode.WRITE);fileStream.writeUTFBytes(newXMLStr);fileStream.close();