Write with AIR applications to the application resource directory

AIR applications are not permitted to write to the application resource directory. This seems to be a security feature and makes sense, because some systems would not allow to write into this directory at system level.

But for testing purposes you might hack this by using a single line of code:

Actionscript:
  1. // Writing into that file would fail
  2. var yourFileInAppDir: File = File.applicationDirectory.resolvePath( "yourFile.xml" );
  3. // This is the simple hack:
  4. yourFileInAppDir = new File( yourFileInAppDir.nativePath );

But this only avoids a AIR security error! You must be sure to have write access to the directory!

1 Response to “Write with AIR applications to the application resource directory”


  1. 1 Avinash

    It’s really cool…I was trying too much to find a way to write to Application Directory. But, I didn’t find any direct approach.
    It seems hard to believe at first….but it works..

Leave a Reply