The difference in storage space in the air

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

Can someone explain when the file will be stored .....

especially in windows

+7
file-io air storage location
source share
4 answers

AIR applicationStorageDirectory will automatically target these locations depending on which OS 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/

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

+21
source share

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

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

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

  • File.desktopDirectory : user desktop directory. If the platform does not determine the desktop directory, another location in the file system is used.

  • File.documentsDirectory : directory of user documents. If the platform does not define a document directory, another location in the file system is used.

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

If you specify the publisher ID in the AIR application descriptor, the publisher ID is added to the application ID.

Android

  • File.applicationDirectory (read-only)

    /data/data/

  • calling 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

  • calling File.applicationStorageDirectory

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

  • File.cachedirectory

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

  • File.desktopDirectory - unavailable

  • File.documentsDirectory

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

  • temporary - from createTempDirectory() and createTempFile()

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

  • File.userDirectory - unavailable

Linux

  • File.applicationDirectory (read-only)

    /opt/<filename>/share

  • calling 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) isolated

    /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>

Window

  • File.applicationDirectory (read-only)

    C:\Program Files\<filename>

  • calling 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>

A source

+19
source share

Copy Victor's comment: In later versions of OS X, ApplicationStorageDirectory will be located in / Users / USERNAME / Library / Application Support / APPLICATIONNAME

This is the correct location in MAC OS in 2016

+1
source share

In addition to TheDarkini1978 answer:

File.applicationDirectory is read-only, do not try to save files there. The resolvePath function creates a file object with a name relative to the specified file. When in doubt, always look at the docs: File

0
source share

All Articles