mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-09 01:01:07 +00:00
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
This commit is contained in:
parent
50402836c4
commit
3ad8b20337
1 changed files with 6 additions and 15 deletions
|
@ -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. */
|
||||
|
|
Loading…
Reference in a new issue