2015-11-18 74 views
2

我正尝试构建一个简单的应用程序,通过简单的双击即可由最终用户启动。修改Info.plist以启动应用程序

这里是文件夹树我有:

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/ 

你能帮我找出我的程序有什么问题吗?

回答

0

看来我一切正常。但是我需要重命名.app包,然后重新命名它。 Mac OS需要“重新加载”Info.plist,否则这些更改不会计数。这是完全愚蠢和愚蠢的,它使我年龄增长找出答案。

相关问题