Mac copy of a Blitz app

Archives Forums/MacOS X Discussion/Mac copy of a Blitz app

remz(Posted 2006) [#1]
This problem seems to persist even with the new 1.20 update:
If you copy / paste a Blitz compiled app (i.e.: hello.debug.app -> hello.debug copy.app), this new copy will not start under Finder with the message:
"You cannot open the application "hello.debug copy.app" because it may be damaged or incomplete."

Note: Any name you give to this copy won't work either. The only way I found to make a working separate copy of a blitz app is by copying it to a different folder, keeping the name intact.


skidracer(Posted 2006) [#2]
I would guess you need to edit some files inside the .app folder also (yes executables are directories on Macs).


remz(Posted 2006) [#3]
Hi,

No I already tried on every file I could figure out.

I am pretty curious on actually what would cause that error, since any other Mac app can be copied and renamed without problem.
It must be some hard-reference to the original file name stored inside a cryptic binary ressource.


Todd(Posted 2006) [#4]
This happens because apps that are produced by BlitzMax don't have the CFBundleExecutable key set in their Info.plist files. You just need to add this key to the Info.plist file, and things will work like you expect. For example:

1. Right-click your app and choose Show Package Contents.
2. Open the Info.plist file in Property List Editor.
3. Click the arrow next to "Root", highlight "Root", then click "New Child".
4. Give "CFBundleExecutable" for the key, and your app's name for the value.

You may need to "touch" the app for the new setting to work. Open Terminal and type "touch /Path/To/MyApp.app".


ImaginaryHuman(Posted 2006) [#5]
hey, good file copy protection scheme


Tricky(Posted 2006) [#6]
The word copy came in the file name.
Somehow I get the feeling the "UNIX executable file" that is attached to this bundle hasn't. But I would think that MacOS is sophisticated enough to automaticly change that. Or am I expecting too much?


ImaginaryHuman(Posted 2006) [#7]
Cant this be properly implemented into the max compiler? we shouldn't have to deal with this kind of issue - renaming a file is very basic and if doing so completely prevents it from running that's a big issue.


remz(Posted 2006) [#8]
I second:
This is from apple developper site:

Important: You must include a valid CFBundleExecutable key in your bundle’s information property list file. Mac OS X uses this key to locate the bundle’s executable or shared library in cases where the user renames the application or bundle directory.


link source:
http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/PListKeys.html#//apple_ref/doc/uid/20001431-101685

Blitzmax should set this automatically.


Brucey(Posted 2006) [#9]
Blitzmax should set this automatically

I agree :-)


Brucey(Posted 2006) [#10]
okay... here we go...

You need to edit the bmk.bmx file to enable this...

From the BlitzMax IDE, you can go to Projects/src/bmk

Search for "<dict>"
After it, insert the following code :
t.WriteLine "~t<key>CFBundleExecutable</key>"
t.WriteLine "~t<string>"+appId+"</string>"

Compile bmk with "Debug Build" and "Build GUI App" disabled - cuz it's a command-line app.

Open the BlitzMax/bin folder and create a backup of the existing bmk exe before you copy over it with this new version (well, better safe than sorry ;-)

Someone should probably pester BRL to include this in the official bmk...

:o)