This content has been marked as final. Show 2 replies
The copy you put in src may get put in the application storage directory on installing, but it certainly won't be there during development. The application storage directory is buried deeply under the user's home folder, and predicting the actual path is difficult. If you have multiple versions of an application installed, each will get a different directory.
Because of all this uncertainty, I gave up on this in my application. Instead, during startup, my program looks for a few data files it needs, and if they aren't there, it downloads them from the program's web site. The trickiest part of this is that you have to write your program so that it disables parts of the UI that depend on the data files until they arrive.
An advantage of this is that you can update the canonical versions of the files on the server without shipping a new version of the program. If someone roaches their data file, you can tell them how to delete it, then have them relaunch the program to get a clean copy. Beats reinstalling it.
Using Flex Builder 3, I have a support folder in which I have a pre-populated database. Upon firstrun, I look to see if the database is in the applicationStorageDirectory, and if not I copy it over:
var db:File = File.applicationDirectory;
db = db.resolvePath('presets' + File.separator + 'sqliteDatabase.db');
var dest:File = File.applicationStorageDirectory;
dest = dest.resolvePath('sqliteDatabase.db');
if ( ! dest.exists )
Another option would be to have the SQL for building the database in a text file, and execute it on first run.