Flash 将.app/.exe文件与Adobe Air app捆绑并执行

Flash 将.app/.exe文件与Adobe Air app捆绑并执行,flash,air,executable,flash-builder,Flash,Air,Executable,Flash Builder,我正在构建一个Air应用程序,它使用.app/.exe文件作为连接硬件设备的桥梁 理想情况下,我希望在Air应用程序安装程序中包含可执行文件,并与Air应用程序一起启动外部程序 1) 这可能吗? 2) 如何决定启动哪个操作系统特定的文件 编辑:好的,上面的内容不是很难: var file:File = File.applicationDirectory; file = file.resolvePath("src/assets/NativeApps"); if (Capabilities.os.

我正在构建一个Air应用程序,它使用.app/.exe文件作为连接硬件设备的桥梁

理想情况下,我希望在Air应用程序安装程序中包含可执行文件,并与Air应用程序一起启动外部程序

1) 这可能吗?
2) 如何决定启动哪个操作系统特定的文件

编辑:好的,上面的内容不是很难:

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)
但是为什么我会收到这个错误消息呢

ArgumentError:Error#3214:NativeProcessStartupInfo.executable未指定有效的可执行文件


.app扩展名无效吗?

有一个关于执行外部程序的线程:

当然,您可以检测操作系统:


还可以创建特定于操作系统的本机安装程序。

.app实际上是一个文件夹。要访问内部的可执行文件,您必须引用
YourApp.app/Contents/MacOS/YourApp

您是否尝试过不使用.app扩展名?比如file.resolvePath(“Mac/echoTestMac”)?我自己从来没有在AIR中使用过NativeProcess,但是一般来说,在macos.Lars中省略应用程序的扩展是很常见的,谢谢您的输入。然而,应用程序扩展似乎可以工作:trace(file.exists)=>true-因此它显然找到了一些东西。。。