views:

28

answers:

1

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?

A: 

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.

Michael Brewer-Davis
thanks for the advice. I was concidering writing directly into the app to enable a user to modify the application configuration and redistributing the app.Shame on me for not believing the docs without bugging you guys.
tommy