We are building an RIA using AIR/Flex and I have some general questions on application architecture where local storage is concerned.
Our application is very heavy in media: images, flash-based animations, sound clips etc. The total size of the application will be on the order of 1 GB, mostly in the form of files on disk. The application will also use a SQL Lite database that contains quite a bit of data, perhaps seveal megabytes. We need to support the scenario of multiple users using the same files on disk, as well as sharing the same SQL Lite database. Only one user at a time will be logged into the computer and using the application of course, but it doesn't make sense for every user to have their own copy of all this data.
The way we have done this previously is to store application-specific data in locations like:
On Windows XP: C:\Documents and Settings\All Users\MyApp
On Windows Vista: C:\ProgramData\MyApp
On Mac OS X: /Application Support/MyApp
All of the methods on the File object in ActionScript return folders that are specific to a given USER. I see no way to reach the "All Users" or "ProgramData" folders. Is there any way to do this? Hard coding these paths is clearly a horrible idea.
Also, once I have created a file, the SQL Lite db file for example, is there a way to set permissions on such a file - in Windows or Mac - to make certain that when other users log in they will be able to read/write to the file? On the Mac, for example, when User1 writes a file to /Application Support/MyApp/someFile.txt, other users can not also write to it.
Unfortunately, there are no properties representing an "All Users" directory. I think your only solution will be to provide your own logic for finding the file path.