mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 12:32:34 +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
|
||||
{
|
||||
const int commandLineParametersCount = Args->NumArgs();
|
||||
assert(commandLineParametersCount > 0);
|
||||
|
||||
NSString* executablePath = [NSString stringWithUTF8String:Args->GetArg(0)];
|
||||
NSString* architecture = GetArchitectureString();
|
||||
|
||||
NSMutableArray* arguments = [NSMutableArray arrayWithCapacity:commandLineParametersCount + 6];
|
||||
[arguments addObject:@"-arch"];
|
||||
[arguments addObject:architecture];
|
||||
[arguments addObject:executablePath];
|
||||
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:GetArchitectureString()];
|
||||
[arguments addObject:executablePath];
|
||||
|
||||
executablePath = @"/usr/bin/arch";
|
||||
}
|
||||
|
||||
[arguments addObject:@"-wad_picker_restart"];
|
||||
[arguments addObject:@"-iwad"];
|
||||
[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)];
|
||||
[arguments addObject:currentParameter];
|
||||
|
@ -442,7 +449,8 @@ static void RestartWithParameters(const char* iwadPath, NSString* parameters)
|
|||
wordfree(&expansion);
|
||||
}
|
||||
|
||||
[NSTask launchedTaskWithLaunchPath:@"/usr/bin/arch" arguments:arguments];
|
||||
[NSTask launchedTaskWithLaunchPath:executablePath
|
||||
arguments:arguments];
|
||||
|
||||
_exit(0); // to avoid atexit()'s functions
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue