Ignore a command line option (for Mac OS bundles)
I'm trying to create a Mac OS executable bundle for dillo. This will be immensely helpful in increasing the reach of dillo to Mac users, as majority of them shudder and run away when they hear they have to download, (compile and) install the following: 1. Xcode 3 (which is a 4GB download!) 2. FLTK 3. libjpeg 4. libpng 5. zlib I've so far managed to cross compile both 32 bit and 64 bit binaries of dillo (same with fltk, libjpeg, libpng, zlib), create a bundle (which fixes the icon problem) and almost get it to run on another machine. I have a small problem however and can use some help. It turns out Mac OS passes a command line argument to applications when it runs them as a bundle. The command line option is something like -psn_0_25790615, where the latter part of the number is different in each run. Dillo of course freaks out when it sees it, prints out the help text (correct usage and whatnot) and exits. Can you please add a case to the command line parsing code to ignore an option if it includes text "-psn_0"? I could give it a shot but chances are I'll break something else. Something like this should work: if (string(argv[1]).find("-psn_") == 0) { _MSG("Apparently a mac bundle", 0); _MSG(argv[1], 0); //ignore this option and move to the next; (Code sample from https://svn.janelia.org/penglab/projects/v3d/trunk/v3d_main/v3d/v3d_commandl...) Thanks, Reza
reza wrote:
I'm trying to create a Mac OS executable bundle for dillo. This will be immensely helpful in increasing the reach of dillo to Mac users, as majority of them shudder and run away when they hear they have to download, (compile and) install the following:
1. Xcode 3 (which is a 4GB download!) 2. FLTK 3. libjpeg 4. libpng 5. zlib
I've so far managed to cross compile both 32 bit and 64 bit binaries of dillo (same with fltk, libjpeg, libpng, zlib), create a bundle (which fixes the icon problem) and almost get it to run on another machine. I have a small problem however and can use some help.
It turns out Mac OS passes a command line argument to applications when it runs them as a bundle. The command line option is something like -psn_0_25790615, where the latter part of the number is different in each run. Dillo of course freaks out when it sees it, prints out the help text (correct usage and whatnot) and exits.
Can you please add a case to the command line parsing code to ignore an option if it includes text "-psn_0"? I could give it a shot but chances are I'll break something else. Something like this should work:
if (string(argv[1]).find("-psn_") == 0) { _MSG("Apparently a mac bundle", 0); _MSG(argv[1], 0); //ignore this option and move to the next;
(Code sample from https://svn.janelia.org/penglab/projects/v3d/trunk/v3d_main/v3d/v3d_commandl...)
Perhaps a relatively clean solution would be for you to have a wrapper -- whatever the moral equivalent of a shell script might be under these circumstances -- that removes the argument and then calls Dillo.
On Sat, Jun 4, 2011 at 5:19 PM, corvid <corvid@lavabit.com> wrote:
reza wrote:
I'm trying to create a Mac OS executable bundle for dillo. This will be immensely helpful in increasing the reach of dillo to Mac users, as majority of them shudder and run away when they hear they have to download, (compile and) install the following:
1. Xcode 3 (which is a 4GB download!) 2. FLTK 3. libjpeg 4. libpng 5. zlib
I've so far managed to cross compile both 32 bit and 64 bit binaries of dillo (same with fltk, libjpeg, libpng, zlib), create a bundle (which fixes the icon problem) and almost get it to run on another machine. I have a small problem however and can use some help.
It turns out Mac OS passes a command line argument to applications when it runs them as a bundle. The command line option is something like -psn_0_25790615, where the latter part of the number is different in each run. Dillo of course freaks out when it sees it, prints out the help text (correct usage and whatnot) and exits.
Can you please add a case to the command line parsing code to ignore an option if it includes text "-psn_0"? I could give it a shot but chances are I'll break something else. Something like this should work:
if (string(argv[1]).find("-psn_") == 0) { _MSG("Apparently a mac bundle", 0); _MSG(argv[1], 0); //ignore this option and move to the next;
(Code sample from
https://svn.janelia.org/penglab/projects/v3d/trunk/v3d_main/v3d/v3d_commandl... )
Perhaps a relatively clean solution would be for you to have a wrapper -- whatever the moral equivalent of a shell script might be under these circumstances -- that removes the argument and then calls Dillo.
Unfortunately by the time the first executable of the bundle (my script) gets to run, the current working directory is somehow reset to /, and I don't know how to retrieve the runtime bundle directory.
I still think that my suggested solution is an easier one to implement without wrestling with the Mac OS bundle execution policy, even though I concur your solution is more elegant. _______________________________________________
Dillo-dev mailing list Dillo-dev@dillo.org http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
participants (2)
-
corvid@lavabit.com
-
rf.opensource@gmail.com