BASE: Ignore -psn command line argument on OS X

Prior to OS X 10.9, the OS was passing the process serial number
as an additional argument on OS X when starting an application bundle.
For whatever reason, when compiling with SDL 1.2 this gets suppressed
before getting to the place where we handle command line arguments.
But when compiling with SDL2 this additional argument remains so we
need to ignore it to avoid erroring out.
This commit is contained in:
Thierry Crozat 2016-03-13 21:51:23 +00:00
parent edfc84b67a
commit 4cb5c81192

View File

@ -373,6 +373,12 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
// We defer checking whether this is a valid target to a later point.
return s;
} else {
// On MacOS X prior to 10.9 the OS is sometimes adding a -psn_X_XXXXXX argument (where X are digits)
// to pass the process serial number. We need to ignore it to avoid an error.
#ifdef MACOSX
if (strncmp(s, "-psn_", 5) == 0)
continue;
#endif
bool isLongCmd = (s[0] == '-' && s[1] == '-');