Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
0

File.applicationStorageDirectory problem

New Here ,
Sep 09, 2012 Sep 09, 2012

Hello dear adobe air community!

I'm new to air mobile development and i'm currently facing a weird problem with File API and its applicationStorageDirectory property.

Please correct me if i'm wrong but it seems that every files stored in applicationStorageDirectory are not deleted during application update, true?

In m'y case, I'm using applicationStorageDirectory to store application database with some user settings. Obviously, these settings should be kept during application update process. Unfortunately, they are removed each time I'm updating the application...

Any ideas? Can this behaviour should result for a bad configuration of my air descriptor file?

Thanks in advance for your help...

TOPICS
Development
2.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 10, 2012 Sep 10, 2012

How do you install this database? Do you check that exists before creating it? If you include a database with your app by default, do you check before you move it? You some random thoughts on some tiems that get overlooked sometimes.

Chris

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 10, 2012 Sep 10, 2012

Thank you Chris for your quick answer.

My database file is copied when the application starts up.

A check is performed before copying the database file.

However, after application update, the database seems to be removed  and recreated...

The following code performs the database initialization:

/**
* Init the database with a default database file.
*
* @param dbFilePathSource
* @param dbFilePathTarget
*/
public static function initDatabase(dbFilePathSource:String, dbFilePathTarget:String):void {
    trace("IN initDatabase.");

    // DB files lookup
    var embeddedSessionDB:File = File.applicationDirectory.resolvePath(dbFilePathSource);
    var writeSessionDB:File = File.applicationStorageDirectory.resolvePath(dbFilePathTarget);

    // If a writable DB doesn't exist, then we copy it into the app folder so it's writable
    if (!writeSessionDB.exists) {
        trace("DB file does not exist at path [" + dbFilePathTarget + "]. DB file file be created from reference file stored at path [" + dbFilePathSource + "].");
        embeddedSessionDB.copyTo(writeSessionDB);
    }
}

Thank you...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Sep 10, 2012 Sep 10, 2012

Please refer to http://blogs.adobe.com/airodynamics/2012/03/05/app-compliance-with-apple-data-storage-guidelines/ for more details about various directories and how they are used.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 10, 2012 Sep 10, 2012

Ok thanks a lot for this link. It is exactly what i want!

Since the data are generated from the end user, i'll be able to store the db file in the "documentDirectory"

I suppose the file will be preserved after the application update, right?

But another question is: Is this file deleted if the user decide to remove the application from its device?

Thank you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Sep 10, 2012 Sep 10, 2012

Yes the file will be preserved after the application update. All files are deleted when application is removed/deleted from the device.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 10, 2012 Sep 10, 2012
LATEST

I'll make the change. You helped me a lot.

Big thanks to everyone.

Le 10 sept. 2012 à 18:30, Varun Bhatia <forums@adobe.com> a écrit :

Re: File.applicationStorageDirectory problem

created by Varun Bhatia in Mobile Development - View the full discussion

Yes the file will be preserved after the application update. All files are deleted when application is removed/deleted from the device.

Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:

To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.

Start a new discussion in Mobile Development by email or at Adobe Forums

For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines