Strip out command line arguments added by the macOS Finder even without SDLmain.a

This commit is contained in:
Michael Martin
2019-11-23 17:00:03 -08:00
parent 36f9e43d75
commit 21740dd74b
+11
View File
@@ -805,6 +805,17 @@ parseOptions (int argc, char *argv[], struct options_struct *options)
return EXIT_FAILURE;
}
#ifdef __APPLE__
// If we are launched by double-clicking an application bundle, Finder
// sticks a "-psn_<some_number>" argument into the list, which makes
// getopt extremely unhappy. Check for this case and wipe out the
// entire command line if it looks like it happened.
if ((argc >= 2) && (strncmp (argv[1], "-psn_", 5) == 0))
{
return EXIT_SUCCESS;
}
#endif
while (!badArg)
{
int c;