Re: [gtk+osx] Working .app bundles
Status: Beta
Brought to you by:
jralls
From: Bob I. <bo...@re...> - 2004-01-06 00:11:54
|
On Jan 5, 2004, at 5:50 PM, John-Michael Mulesa wrote: > Bob Ippolito wrote: >> On Jan 5, 2004, at 4:46 PM, Bob Ippolito wrote: >>> >>> On Jan 5, 2004, at 4:20 PM, John-Michael Mulesa wrote: >>> >>>> Does anyone here know how to make a gtk-osx .app bundle program >>>> double clickable? Right now you still have to run it from terminal, >>>> because if you double click it, it immediately quits and outputs >>>> this to the console (GIMP - OSX in this case): >>> >>> >>> Yeah, this is a quick hack, but change main to something like this: >>> >>> int main(int argc, char **argv) { >>> if (argc == 2 && strncmp(argv[1], "-psn", 4) == 0) argc = 1; >>> /* rest of code */ >>> } >>> >>> argv is used for something else when launching .app bundles (passing >>> in a process serial number). Opening files or printing is actually >>> done by an 'odoc' event post-launch, not with argv. >>> >>> Alternatively, you can change the Info.plist to use a different >>> executable (can even be a python script, so long as its +x and you >>> don't need 10.1 compat) whose sole purpose is to swallow the >>> "extraneous" arguments and then execve the actual process. >> And here's an example.. to get the demo "gimp 1.2" app bundle to run >> by double clicking: >> cd /Applications/gimp-1.2.app/Contents/MacOS >> mv gimp-1.2 gimp-1.2-executable >> create a gimp-1.2 file that looks like this: >> #!/usr/bin/python >> import sys, os >> if len(sys.argv) == 2 and sys.argv[1].startswith('-psn'): >> sys.argv = sys.argv[1:] >> os.execve(os.path.join(os.path.dirname(sys.argv[0]), >> os.path.basename(sys.argv[0])+'-executable'), sys.argv[:1], >> os.environ) >> chmod +x gimp-1.2 > I made the file, but it doesn't want to run (did do chmod +x): > > /Users/jm/Desktop/gimp-1.2.app/Contents/MacOS/gimp-1.2: Command not > found. > > When I try to run it. In theory, I guess that can happen if you don't have Python. Maybe you don't have the BSD subsystem installed? Otherwise you should have it, because it's been a standard part of the BSD subsystem since OS X 10.2. -bob |