Just had to deal with this myself recently. There is no way to do this during
install which leaves you with a couple of options:
1) Do a test to see if it's the first time the application has been run and
copy the files to app storage
2) Test for the existence of the files in app storage, if they don't exist,
copy them from the app directory.
#1 is basically a more complicated version of #2 so I'll just give you the
quick and dirty #2 version:
This code is in my SQLService class. This is just the class I use to handle
all my SQL stuff.
_dbFile = File.applicationStorageDirectory.resolvePath(_dbPath);
_dbTemplateFile = File.applicationDirectory.resolvePath(_dbPath);
// If the file does not exists in storage or the one in the application
directory is newer, copy it from the applciation directory
if(!_dbFile.exists || (_dbTemplateFile.modificationDate >
_dbFile.modificationDate && updateDbFile))
{
_dbTemplateFile.copyTo(_dbFile, true);
}
This post should help you with the first run part:
http://www.mikechambers.com/blog/2007/11/07/detecting-whether-an-air-application-has-run-before/
Adobe has a resource about this as well (that's what I used) but I cannot find
it at the moment and my bookmark is on my work computer.
--- In [email protected], "handitan" <handi...@...> wrote:
>
> Ugh, I just tried moving file programmatically from app to appStorage. It
> gave me security error.
>
> Please enlighten me.
>
> --- In [email protected], "handitan" <handitan@> wrote:
> >
> > Hi all,
> >
> > To my knowledge, it's not possible unless it's being done through
> > programmatically.
> >
> > I have some sqlite DBs as part of my AIR package. I would like to have
> > those DBs completely moved to the application storage when the package is
> > installed on my client computer.
> >
> > Any ideas?
> >
> > Thx!
> >
>