Search code examples
airfilesystems

Resolving relative paths outside the standard directories (applicationDirectory, desktopDirectory, etc)


I need to navigate to a file relative to my applicationDirectory, but as it says in the documentation:

No ".." reference that reaches the file system root or the application-persistent storage root passes that node; it is ignored.

But the crazy thing is that if I do something like

File.applicationDirectory.resolvePath("/home/myHome/");

I can get anywhere in the filesystem.

My question is: is there a workaround to navigate from my applicationDirectory to a relative path like "../../my.cfg" ?? (I need to read a config file generated by a different application)


Solution

  • if you are trying to access root privileged folders - than you can not.

    in other cases try do next "home/blah/blah/blah/../../my.cfg" and research once again http://help.adobe.com/en_US/AIR/1.5/jslr/flash/filesystem/File.html to save your time about navigation.

    also you have another few ways: create a link to your file or run external bash/bat script.