The Difference Of Location Storage File in air
Asked Answered
D

4

9

I want to ask the difference between air.File.documentsDirectory.resolvePath, File.userDirectory.resolvePath, air.File.applicationDirectory.resolvePath..

Can anybody explain when does the file will be store.....

especially in windows

Decipher answered 9/11, 2010 at 3:13 Comment(0)
M
25

AIR's applicationStorageDirectory will automatically target these locations depending on which OS the application is running:

  • Windows 7 / Vista: c:\users\USERNAME\appdata\roaming\APPLICATIONNAME

  • Windows XP: c:\Documents and Settings\USERNAME\Application Data\APPLICATIONNAME

  • Mac OS X: /Users/USERNAME/Library/Preferences/APPLICATIONNAME

  • Linux (Ubuntu): /Users/USERNAME/.appdata/

along with desktopDirectory, documentsDirectory, applicationDirectory (read-only), which, too, have their own specific locations, these are built-in conveniences that allow AIR developers to produce cross-platform applications without having to know about (or specifically code for) the file system of a target OS.

Milquetoast answered 9/11, 2010 at 6:47 Comment(2)
I'd like to append the following if someone comes across this question more recently as I did: In later versions of OS X, applicationStorageDirectory will be in /Users/USERNAME/Library/Application Support/APPLICATIONNAMEDeonnadeonne
@TheDarkIn1978 you should include Victor's suggestion in your answer.Alexandrite
M
21

This info applies to AIR 1.0 and later (ActionScript 3.0)

  • File.applicationStorageDirectory: a storage directory unique to each installed AIR application. This directory is an appropriate place to store dynamic application assets and user preferences. Consider storing large amounts of data elsewhere. On Android and iOS, the application storage directory is removed when the application is uninstalled or the user chooses to clear application data, but this is not the case on other platforms.

  • File.applicationDirectory: the directory where the application is installed (along with any installed assets). On some operating systems, the application is stored in a single package file rather than a physical directory. In this case, the contents may not be accessible using the native path. The application directory is read-only.

  • File.desktopDirectory: the user’s desktop directory. If a platform does not define a desktop directory, another location on the file system is used.

  • File.documentsDirectory: the user’s documents directory. If a platform does not define a documents directory, another location on the file system is used.

  • File.userDirectory: the user directory. If a platform does not define a user directory, another location on the file system is used.

If you specify a publisher ID in the AIR application descriptor, then the publisher ID is appended to the applicationID.

Android

  • File.applicationDirectory (read-only)

    /data/data/

  • File.applicationStorageDirectory

    /data/data/<applicationID>/<filename>/Local Store

  • File.cacheDirectory

    /data/data/<applicationID>/cache

  • File.desktopDirectory

    /mnt/sdcard

  • File.documentsDirectory

    /mnt/sdcard

  • temporary - from File.createTempDirectory() and File.createTempFile()

    /data/data/<applicationID>/cache/FlashTmp.<randomString>

  • File.userDirectory

    /mnt/sdcard

iOS

  • File.applicationDirectory (read-only)

    /var/mobile/Applications/<uid>/<filename>.app

  • File.applicationStorageDirectory

    /var/mobile/Applications/<uid>/Library/Application Support/<applicationID>/Local Store

  • File.cacheDirectory

    /var/mobile/Applications/<uid>/Library/Caches

  • File.desktopDirectory - not accessible

  • File.documentsDirectory

    /var/mobile/Applications/<uid>/Documents

  • temporary - from createTempDirectory() and createTempFile()

    /private/var/mobile/Applications/<uid>/tmp/FlashTmp<randomString>

  • File.userDirectory - not accessible

Linux

  • File.applicationDirectory (read-only)

    /opt/<filename>/share

  • File.applicationStorageDirectory

    /home/<userName>/.appdata/<applicationID>/Local Store

  • File.desktopDirectory

    /home/<userName>/Desktop

  • File.documentsDirectory

    /home/<userName>/Documents

  • temporary - from createTempDirectory() and createTempFile()

    /tmp/FlashTmp.<randomString>

  • File.userDirectory

    /home/<userName>

Mac

  • File.applicationDirectory (read-only)

    /Applications/<filename>.app/Contents/Resources

  • File.applicationStorageDirectory (AIR 3.2 and earlier)

    /Users/<userName>/Library/Preferences/<applicationID>/Local Store

  • File.applicationStorageDirectory (AIR 3.3 and later)

    /Users/<userName>/Library/Application Support/<applicationID>/Local Store

  • File.applicationStorageDirectory (AIR 3.3 and later) sandboxed

    /Users/<userName>/Library/Containers/<bundleID>/Data/Library/Application Support/<applicationID>/Local Store

  • File.cacheDirectory

    /Users/<userName>/Library/Caches

  • File.desktopDirectory

    /Users/<userName>/Desktop

  • File.documentsDirectory

    /Users/<userName>/Documents

  • temporary - from createTempDirectory() and createTempFile()

    /private/var/folders/<userName?>/<randomString>/TemporaryItems/FlashTmp

  • File.userDirectory

    /Users/<userName>

Windows

  • File.applicationDirectory (read-only)

    C:\Program Files\<filename>

  • File.applicationStorageDirectory

    C:\Documents and settings\<userName>\ApplicationData\<applicationID>\Local Store

  • File.cacheDirectory

    C:\Documents and settings\<userName>\Local Settings\Temp

  • File.desktopDirectory

    C:\Documents and settings\<userName>\Desktop

  • File.documentsDirectory

    C:\Documents and Settings\<userName>\My Documents

  • temporary - from createTempDirectory() and createTempFile()

    C:\Documents and Settings\<userName>\Local Settings\Temp\<randomString>.tmp

  • File.userDirectory

    C:\Documents and Settings\<userName>

Source

Melodee answered 19/9, 2013 at 14:3 Comment(1)
On Windows 10, File.applicationStorageDirectory is C:\Users\<userName>\AppData\Roaming\<applicationID>\Local StoreBartolommeo
T
1

Copying from Victor's comment: In later versions of OS X, applicationStorageDirectory will be in /Users/USERNAME/Library/Application Support/APPLICATIONNAME

This is the correct location in MAC OS in 2016

Tormoria answered 19/12, 2016 at 10:41 Comment(0)
R
0

In addition to TheDarkini1978's answer:

File.applicationDirectory is read only, don't try to save files there. resolvePath function creates file object with name relative to given file. When in doubt, always see the docs: File

Rennold answered 9/11, 2010 at 7:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.