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."
This commit is contained in:
Robert Osfield
2005-06-15 11:49:25 +00:00
parent dfaed083ea
commit 92087ee5ac

View File

@@ -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;pos<this->argc();++pos)
{
if (std::string(_argv[pos]).compare(0, 4, std::string("-psn")) == 0)
{
remove(pos, 1);
}
}
#endif
}
std::string ArgumentParser::getApplicationName() const