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
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
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.
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.
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
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
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>
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>
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>
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
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
© 2022 - 2024 — McMap. All rights reserved.