From 3d0ea018ed007a1c8921845a2bdb694334899210 Mon Sep 17 00:00:00 2001 From: David Ludwig Date: Sat, 22 Jul 2017 21:49:54 -0400 Subject: [PATCH] bug-fix: OS X app would not launch, when run from the Finder --- BasiliskII/src/Unix/main_unix.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/BasiliskII/src/Unix/main_unix.cpp b/BasiliskII/src/Unix/main_unix.cpp index d996c6a5..f8dc7431 100644 --- a/BasiliskII/src/Unix/main_unix.cpp +++ b/BasiliskII/src/Unix/main_unix.cpp @@ -427,11 +427,18 @@ int main(int argc, char **argv) } else if (strcmp(argv[i], "--rominfo") == 0) { argv[i] = NULL; PrintROMInfo = true; - } else if (strcmp(argv[i], "-NSDocumentRevisionsDebugMode") == 0) { - // HACK: prevent Basilisk from exiting, when run via Xcode 8, which - // passes in a '-NSDocumentRevisionsDebugMode' option. + } + +#if defined(__APPLE__) && defined(__MACH__) + // Mac OS X likes to pass in various options of its own, when launching an app. + // Attempt to ignore these. + const char * mac_psn_prefix = "-psn_"; + if (strcmp(argv[i], "-NSDocumentRevisionsDebugMode") == 0) { + argv[i] = NULL; + } else if (strncmp(mac_psn_prefix, argv[i], strlen(mac_psn_prefix)) == 0) { argv[i] = NULL; } +#endif } // Remove processed arguments