R – Does Adobe Air have unconstrained file system access

actionscriptairapache-flexfilefile-io

I've found several examples and documentation that show how to read and write files on the system, but all show user intervention or reading/writing files in user profile directories. There are a few things I want to do:

  1. Monitor system and other application log files for changes, then automatically load those files when changes occur
  2. Reload a previously open file when the application launches
  3. Write files into a log directory, which probably will not exist in the same path as the application.

In my very quick search, it seems that there may be a security model that constrains an AIR application's access to the file system, so that files can only be read or written to directories selected by the user with the file system dialog OR files can be written within the user profile or air application directory.

Does an Adobe Air application have unconstrained access to the file system?

Best Answer

AIR has exactly the same access to the file system as the current User. If you are admin on your computer, AIR har full access to all files. If you are a restricted user, AIR has restricted access.

One thing to be mindful of is that if you load swf:s from the AIR app's home directory, it will be run in the Application sandbox. If you read it from outside, it will be executed within a File sandbox which is essentially the same as loading from the web.

Some comments on your list:

1 Monitor system and other application log files for changes, then automatically load those files when changes occur

As far as I know, AIR cannot monitor the file system. You will have to poll this regularly.

2 Reload a previously open file when the application launches

Save this info in a file or SQLite and check it when the app starts.

3 Write files into a log directory, which probably will not exist in the same path as the application.

The main thing to remember is to use the file path abstractions in AIR rather than OS specific paths such as c:/

Related Topic