- escape double quotes in Cocoa IWAD picker's extra arguments

https://forum.zdoom.org/viewtopic.php?t=71675
This commit is contained in:
alexey.lysiuk 2021-03-08 11:44:14 +02:00
parent d18b74b537
commit 952d43b884

View file

@ -389,6 +389,8 @@ static void RestartWithParameters(const WadStuff& wad, NSString* parameters)
@try @try
{ {
NSString* executablePath = [NSString stringWithUTF8String:Args->GetArg(0)]; NSString* executablePath = [NSString stringWithUTF8String:Args->GetArg(0)];
NSString* escapedParameters = [parameters stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""];
NSString* cvarArgument = [NSString stringWithFormat:@"+osx_additional_parameters \"%@\"", escapedParameters];
NSMutableArray* const arguments = [[NSMutableArray alloc] init]; NSMutableArray* const arguments = [[NSMutableArray alloc] init];
[arguments addObject:@"-arch"]; [arguments addObject:@"-arch"];
@ -398,7 +400,7 @@ static void RestartWithParameters(const WadStuff& wad, NSString* parameters)
[arguments addObject:[NSString stringWithUTF8String:wad.Path]]; [arguments addObject:[NSString stringWithUTF8String:wad.Path]];
[arguments addObject:@"+defaultiwad"]; [arguments addObject:@"+defaultiwad"];
[arguments addObject:[NSString stringWithUTF8String:wad.Name]]; [arguments addObject:[NSString stringWithUTF8String:wad.Name]];
[arguments addObject:[NSString stringWithFormat:@"+osx_additional_parameters \"%@\"", parameters]]; [arguments addObject:cvarArgument];
for (int i = 1, count = Args->NumArgs(); i < count; ++i) for (int i = 1, count = Args->NumArgs(); i < count; ++i)
{ {