This is probably a bad idea or whatever you wan't to call it. Nevertheless, curious to know if Air can write inside it's own installed package. I'm referring to the OSX '.app' files found in great numbers in the applications folder. Since every one of these can be opened as a regular folder, i'm guessing that's what they are.
What other fancy filewriting tricks am i missing out on?
It's definitely a bad idea. That said, it looks like it's probably possible. Something like (untested):
var appDir:File = File.applicationDirectory; // uses app: URI, can't be written to
var appPath:String = appDir.nativePath;
var writeableAppDir:File = new File(appPath);
var newFile:File = writeableAppDir.resolvePath("writeme.txt");
The nativePath
and applicationDirectory
documentation in the File
class are full of warnings against this. Follow them.
From the docs:
Modifying content in the application directory is a bad practice, for security reasons. If you want to store application-specific data, consider using the application storage directory (File.applicationStorageDirectory). If you want any of the content in the application storage directory to have access to the application-priveleged functionality (AIR APIs), you can expose that functionality by using a sandbox bridge.