You can use File.applicationDirectory to get the main directory of the application. You should be able to resolve your relative path from there.
- Josh On Wed, Jan 18, 2017 at 11:21 AM, Kyle McKnight <[email protected]> wrote: > I have a Flex/AIR application using flex 4.15 and AIR 20. > > I'm using IntelliJ to build the project. > > I have a run configuration that uses the "flash app" configuration. > > My application starts up a java service and an executable. > > The executable that is started has a relative path coded inside of it that > should lead to a file within some folders that are in the same directory as > the executable. > > If I run adl from the commandline in the directory I want as the runtime > working directory then it works fine. > > If I start the application using Intellij, then Intellij runs this command > first: > > "<path_to_Intellij_home>\jre\jre\bin\java.exe" > -Dapplication.home=<path_to_flex/air_home> -Dfile.encoding=UTF-8 > -Djava.awt.headless=true -Duser.language=en -Duser.region=en -Xmx512m > -classpath <path_to_flex/air_home>/lib/fdb.jar > flex.tools.debugger.cli.DebugCLI -ide > > And then runes the adl command > <path_to_adl>\adl.exe -profile extendedDesktop <path_to_app_xml> > <path_to_root_directory> > > THe problem with this is that then the relative directory that the > executable my app starts up is located at > <path_to_intellij_home>\jre\jre\bin. > > So the executable can't find the needed file. > > The only way I have found around this is to use the flash remote debugger > run configuration, have that configuration run another configuration that > calls a bat file for me first; the bat file changes directory to the > correct directory and then runes the adl command itself, and this > configuration builds first. > > So the order there is build->call runapp.bat (which runs the adl > command)->start REMOTE debugger. But obviously this stinks to have to do. > > So my options are to pass in the path from my app to the executable i'm > starting, or to figure out how to manipulate intellij. > > Anyone run into this or know how I might fix it? > > Kyle McKnight > Senior UI Engineer - Accesso > 602.515.1444 (M) >
