Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundle and execute .app/.exe file with Adobe Air App

I'm building an Air app that uses an .app/.exe file as a bridge to hardware devices.

Ideally, I would like to include the executable with the Air app installer and launch the external program together with the Air app.

1) Is this possible?
2) How do decide which OS specific file to launch?

EDIT: OK, the above wasn't very difficult:

var file:File = File.applicationDirectory;
file = file.resolvePath("src/assets/NativeApps");

if (Capabilities.os.toLowerCase().indexOf("win") > -1) {
    file = file.resolvePath("Windows/echoTestWin.exe");
}
else if (Capabilities.os.toLowerCase().indexOf("mac") > -1) {
    file = file.resolvePath("Mac/echoTestMac.app");
}

var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.executable = file;
var process = new NativeProcess();
process.start(nativeProcessStartupInfo)

But why do I get this error message?

ArgumentError: Error #3214: NativeProcessStartupInfo.executable does not specify a valid executable file.

Isn't the .app extension valid?

like image 380
dani Avatar asked Feb 26 '23 18:02

dani


2 Answers

The .app is actually a folder. To access the executable inside you have to reference YourApp.app/Contents/MacOS/YourApp

like image 74
Greg Avatar answered Mar 17 '23 04:03

Greg


There's a thread about executing an external program: Adobe AIR to execute program

And you can of course detect the OS: http://www.uibuzz.com/?p=1330

It's also possible to create OS specific, native installers.

like image 43
dain Avatar answered Mar 17 '23 04:03

dain