Fixes #490 by quoting script path in Apple Script

This commit is contained in:
Timothy Qiu
2017-09-13 09:59:48 +08:00
parent ae2a409ceb
commit abf06c1085

View File

@ -51,12 +51,12 @@ GCDWebServer *webServer =nil;
NSString *helperPath = [NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath], @"install_helper.sh"];
NSLog(@"run install script: %@", helperPath);
NSDictionary *error;
NSString *script = [NSString stringWithFormat:@"do shell script \"bash %@\" with administrator privileges", helperPath];
NSString *script = [NSString stringWithFormat:@"do shell script \"/bin/bash \\\"%@\\\"\" with administrator privileges", helperPath];
NSAppleScript *appleScript = [[NSAppleScript new] initWithSource:script];
if ([appleScript executeAndReturnError:&error]) {
NSLog(@"installation success");
} else {
NSLog(@"installation failure");
NSLog(@"installation failure: %@", error);
}
}
}