From 92087ee5ac73aeaefc46f4d44756cf4c586f58e4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 15 Jun 2005 11:49:25 +0000 Subject: [PATCH] From David Guthrie, " In the constructor in removes any options beginning with "-psn" from argv on OSX by calling the "remove" method. When a .app run is created in OSX, which is required to get a fully functioning UI application, the OSX finder passes a -psn_XXXX option to the application where the XXXX refers to a unique process number. An example option would be "- psn_0_37617665". The argument parser was choking on this option in all the osg example applications." --- src/osg/ArgumentParser.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/osg/ArgumentParser.cpp b/src/osg/ArgumentParser.cpp index f16cb93db..66562817f 100644 --- a/src/osg/ArgumentParser.cpp +++ b/src/osg/ArgumentParser.cpp @@ -153,6 +153,18 @@ ArgumentParser::ArgumentParser(int* argc,char **argv): _argv(argv), _usage(ApplicationUsage::instance()) { +#ifdef __APPLE__ + //On OSX, any -psn arguments need to be removed because they will + // confuse the application. -psn plus a concatenated argument are + // passed by the finder to application bundles + for(int pos=1;posargc();++pos) + { + if (std::string(_argv[pos]).compare(0, 4, std::string("-psn")) == 0) + { + remove(pos, 1); + } + } +#endif } std::string ArgumentParser::getApplicationName() const