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:

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

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

One thought on “Write with AIR applications to the application resource directory”

  1. 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

This site uses Akismet to reduce spam. Learn how your comment data is processed.