From 4cb5c81192863b6924129c9d4647903d12943364 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 13 Mar 2016 21:51:23 +0000 Subject: 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. --- base/commandLine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'base/commandLine.cpp') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 19702ea36d..105d810460 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -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] == '-'); -- cgit v1.2.3