mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
Fixed launching with additional arguments from IWAD picker on OS X 10.4
This commit is contained in:
parent
1a69221f80
commit
86b2a8530b
1 changed files with 18 additions and 10 deletions
|
@ -408,21 +408,28 @@ static void RestartWithParameters(const char* iwadPath, NSString* parameters)
|
||||||
|
|
||||||
@try
|
@try
|
||||||
{
|
{
|
||||||
const int commandLineParametersCount = Args->NumArgs();
|
|
||||||
assert(commandLineParametersCount > 0);
|
|
||||||
|
|
||||||
NSString* executablePath = [NSString stringWithUTF8String:Args->GetArg(0)];
|
NSString* executablePath = [NSString stringWithUTF8String:Args->GetArg(0)];
|
||||||
NSString* architecture = GetArchitectureString();
|
|
||||||
|
|
||||||
NSMutableArray* arguments = [NSMutableArray arrayWithCapacity:commandLineParametersCount + 6];
|
NSMutableArray* const arguments = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
|
// The following value shoud be equal to NSAppKitVersionNumber10_5
|
||||||
|
// It's hard-coded in order to build with earlier SDKs
|
||||||
|
const bool canSelectArchitecture = NSAppKitVersionNumber >= 949;
|
||||||
|
|
||||||
|
if (canSelectArchitecture)
|
||||||
|
{
|
||||||
[arguments addObject:@"-arch"];
|
[arguments addObject:@"-arch"];
|
||||||
[arguments addObject:architecture];
|
[arguments addObject:GetArchitectureString()];
|
||||||
[arguments addObject:executablePath];
|
[arguments addObject:executablePath];
|
||||||
|
|
||||||
|
executablePath = @"/usr/bin/arch";
|
||||||
|
}
|
||||||
|
|
||||||
[arguments addObject:@"-wad_picker_restart"];
|
[arguments addObject:@"-wad_picker_restart"];
|
||||||
[arguments addObject:@"-iwad"];
|
[arguments addObject:@"-iwad"];
|
||||||
[arguments addObject:[NSString stringWithUTF8String:iwadPath]];
|
[arguments addObject:[NSString stringWithUTF8String:iwadPath]];
|
||||||
|
|
||||||
for (int i = 1; i < commandLineParametersCount; ++i)
|
for (int i = 1, count = Args->NumArgs(); i < count; ++i)
|
||||||
{
|
{
|
||||||
NSString* currentParameter = [NSString stringWithUTF8String:Args->GetArg(i)];
|
NSString* currentParameter = [NSString stringWithUTF8String:Args->GetArg(i)];
|
||||||
[arguments addObject:currentParameter];
|
[arguments addObject:currentParameter];
|
||||||
|
@ -442,7 +449,8 @@ static void RestartWithParameters(const char* iwadPath, NSString* parameters)
|
||||||
wordfree(&expansion);
|
wordfree(&expansion);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NSTask launchedTaskWithLaunchPath:@"/usr/bin/arch" arguments:arguments];
|
[NSTask launchedTaskWithLaunchPath:executablePath
|
||||||
|
arguments:arguments];
|
||||||
|
|
||||||
_exit(0); // to avoid atexit()'s functions
|
_exit(0); // to avoid atexit()'s functions
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue