tags:

views:

25

answers:

1

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)

+1  A: 

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.

Eugene
as I said, my application is placed inside a subfolder of another application, so in order to load the main config file I would need to go up one folder with a "../../". But AIR is limited in that (can't go up further than the main AIR app), so I either use an absolute path (like /home/myHome) or otherwise I'd need to find a workaround. I can't create a link, and I don't know how using a bash could help me. Thank you anyways! it's always good to read others' opinions!
Alberto M
i was mean, some another construction like: **getApplicationPath()+"../../"+url2file**
Eugene
wow, I'm shocked by the solution of the workaround, why did they even put that limitation?! I did something like var baseDir:File.applicationDirectory.resolvePath("."); and it gave me the current path. Then I did var newPath:File = File.applicationDirectory.resolvePath(baseDir.nativePath+"/../../"); and it magically went up, ignoring the thing written in the documentation. Blah. Thank you!
Alberto M

related questions