【发布时间】:2016-02-20 00:37:43
【问题描述】:
我正在尝试构建一个简单的应用程序,最终用户只需双击即可启动。
这是我的文件夹树:
MyProgram.app/
Contents/
Info.plist
MacOS/
exe_not_exe --> this is a dummy exe, but needed
MyProgram-mac-os-x86_64/
MyProgram.app/ ---> THIS APP is executable
Contents/
Info.plist
MacOS/
exe_really_exe --> this is the exe really executed
我希望当用户双击第一个 MyProgram.app 时,应用程序启动,但实际上使用的是exe_really_exe,而不是exe_not_exe。
第一个 Info.plist 有某个地方的关键:
<key>CFBundleExecutable</key>
<string>exe_not_exe</string>
所以我尝试构建这个树文件夹:
MyProgram.app/
Contents/
Info.plist
MacOS/
exe_not_exe
launcher --> this is a new file
MyProgram-mac-os-x86_64/
MyProgram.app/
Contents/
Info.plist
MacOS/
exe_really_exe
在launcher 文件中:
#!/usr/bin/env bash
open ../../MyProgram-mac-os-x86_64/MyProgram.app
open ../../MyProgram-mac-os-x86_64/MyProgram.app/MacOS/exe_really_exe
(我尝试了两种不同的说明)。如果我从其目录启动 launcher 文件,一切都会按预期工作。
我修改了 Info.plist(树中最高的):
<key>CFBundleExecutable</key>
<string>launcher</string>
但最后,如果我双击 MyProgram.app(树中最高的那个),应用程序不会启动。如果我从命令行启动它,我会收到错误:
LSOpenURLsWithRole() failed with error -10810 for the file MyProgram.app/
您能帮我找出我的程序有什么问题吗?
【问题讨论】: