From 3ad8b203373b6fc3dd92bb2d148bfc6d4e834176 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Thu, 8 Sep 2016 08:33:35 +0000 Subject: [PATCH] apply changeset 10313 from the SDL hg repo for SDL-1.2-macosx: 1.2 mac: Apparently the magic -psn command line appears in post-10.9 macOSes. So don't bother checking the version. Fixes apps failing to chdir to the app bundle's parent directory, as is expected. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1342 af15c1b1-3010-417e-b628-4374ebc0bcbd --- MacOSX/SDLMain.m | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/MacOSX/SDLMain.m b/MacOSX/SDLMain.m index f5e7c184..a48066a6 100644 --- a/MacOSX/SDLMain.m +++ b/MacOSX/SDLMain.m @@ -74,25 +74,16 @@ static int IsRootCwd() return (cwd && (strcmp(cwd, "/") == 0)); } -static int IsTenPointNineOrLater() -{ - /* Gestalt() is deprecated in 10.8, but I don't care. Stop using SDL 1.2. */ - SInt32 major, minor; - Gestalt(gestaltSystemVersionMajor, &major); - Gestalt(gestaltSystemVersionMinor, &minor); - return ( ((major << 16) | minor) >= ((10 << 16) | 9) ); -} - static int IsFinderLaunch(const int argc, char **argv) { - const int bIsNewerOS = IsTenPointNineOrLater(); - /* -psn_XXX is passed if we are launched from Finder in 10.8 and earlier */ - if ( (!bIsNewerOS) && (argc >= 2) && (strncmp(argv[1], "-psn", 4) == 0) ) { + /* -psn_XXX is passed if we are launched from Finder, SOMETIMES */ + if ( (argc >= 2) && (strncmp(argv[1], "-psn", 4) == 0) ) { return 1; - } else if ((bIsNewerOS) && (argc == 1) && IsRootCwd()) { + } else if ((argc == 1) && IsRootCwd()) { /* we might still be launched from the Finder; on 10.9+, you might not - get the -psn command line anymore. Check version, if there's no - command line, and if our current working directory is "/". */ + get the -psn command line anymore. If there's no + command line, and if our current working directory is "/", it + might as well be a Finder launch. */ return 1; } return 0; /* not a Finder launch. */