Adobe AIR - reading a file in the same folder outside the AIR package

How can I find out File.nativepath from the folder where my .app or .exe AIR application is running? When I try to do it, I just get

'/Users/MYNAME/Desktop/MYAPP/Contents/Resources/FILETHATINEED.xml

I need to put this in any folder and read the xml file in the same folder. I do not need my XML file inside the package.

I need this structure

/folder/AIRAPP.exe

/folder/FILE.xml

Thanx in advance.

+3
source share
2 answers

, , , . , File.applicationDirectory Mac ( ), :

var appDir = File.applicationDirectory

if ( appDir.resolvePath("../../Contents/MacOS").exists ) {
  appDir = appDir.resolvePath("../../..");
}

, , Mac.app bundle, ( , .app).

+1

, File.applicationDirectory.

0

Source: https://habr.com/ru/post/1704947/


All Articles