The Difference Of Location Storage File in air
Solution 1
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.
Solution 2
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()
andFile.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()
andcreateTempFile()
/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()
andcreateTempFile()
/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()
andcreateTempFile()
/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()
andcreateTempFile()
C:\Documents and Settings\<userName>\Local Settings\Temp\<randomString>.tmp
-
File.userDirectory
C:\Documents and Settings\<userName>
Solution 3
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
Frans Simanjuntak
Updated on July 21, 2022Comments
-
Frans Simanjuntak almost 2 years
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
-
Victor almost 11 yearsI'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/APPLICATIONNAME
-
Sharique Abdullah almost 11 years@TheDarkIn1978 you should include Victor's suggestion in your answer.