

How do you access local resource without using a hard coded absolute path? Jeffre houser has a quick tip for an answer.
There are two URL schemes come from Adobe AIR:
As an indirect correlation, if you need the absolute paths to the application install directory or the application root directory, you can get them using the File Class. So, as Jeffre indicates:
Somewhere in your ActionScript code, just import the class:
import flash.filesystem.File;
Two static variables exist on the File class, applicationDirectory and applicationStorageDirectory. This code saves them to local variables:
public var appDirectory : String = File.applicationDirectory ;
public var storageDirectory : String = File.applicationStorageDirectory ;
That’ll do the trick.
If you would like to make a comment, please fill out the form below.
Nice post Charles … a little nugget more of insight into the bizarre complexities of AIR file storage.
I was hoping to have an AIR application be a data manager (i.e. read from a source XML file, provide application functionality to manipulate the data and then write back out to the sameXML file). Searching so far has made me come to the conclusion I can only write back out to the File.applicationStorageDirectory, which as you conclude above goes into the deep dark depths of a My Documents hidden folder.
Then I was hoping to have another Flex SWF application read the newly updated XML file for data input content … problem is I can’t see so far how I can get the SWF to read that file. Even if I point it to the exotically named hidden My Documents folder URL, it fails to find/read it (same logged on user running both apps) … is this an XP security blocking thing, or is the HTTPService objecting to the windows style full drive path/directory naming convention…
… data validation cut off my last part to that submission. It continued to say:
*mx:HTTPService
url=”C:\Documents and Settings\Darrell\Application Data\applicationAIR.BD7F6092E158CC038D91CDCA067AA8619658B0C9.1\data.xml”*
I tried turning the \ round to / but neither work … unless I put the SWF on the C:\ drive and do some complex url=”..\..\..\..\……”, but seems messy.
Anybody out there got a more elegant solution or a fix for above?
Thanks.
it seems nice. But i have a doubt that how can we access the resources like printer ?
Do you know what the actual path to the application file directory is on a windows machine? I have located the app-storage directory, but not the app. During development and after install?