diff --git a/.gitignore b/.gitignore index b89b7b7..3367a4e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build +build/revision *.xcodeproj/*.pbxuser *.xcodeproj/*.perspectivev3 *.xcodeproj/*.mode1v3 diff --git a/ApplicationController.m b/ApplicationController.m index 86252cd..3a86d38 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -21,7 +21,7 @@ @implementation ApplicationController - (ApplicationController*)init { -#ifndef NDEBUG +#ifdef DEBUG_BUILD [NSApp activateIgnoringOtherApps:YES]; #endif @@ -92,12 +92,16 @@ - (IBAction)openPreferencesWindow:(id)sender - (IBAction)installCliTool:(id)sender; { BOOL success = NO; - NSString* installationPath = @"/usr/local/bin/gitx"; + NSString* installationPath = @"/usr/local/bin/"; + NSString* installationName = @"gitx"; NSString* toolPath = [[NSBundle mainBundle] pathForResource:@"gitx" ofType:@""]; if (toolPath) { AuthorizationRef auth; if (AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth) == errAuthorizationSuccess) { - char const* arguments[] = { "-f", "-s", [toolPath UTF8String], [installationPath UTF8String], NULL }; + char const* mkdir_arg[] = { "-p", [installationPath UTF8String], NULL}; + char const* mkdir = "/bin/mkdir"; + AuthorizationExecuteWithPrivileges(auth, mkdir, kAuthorizationFlagDefaults, (char**)mkdir_arg, NULL); + char const* arguments[] = { "-f", "-s", [toolPath UTF8String], [[installationPath stringByAppendingString: installationName] UTF8String], NULL }; char const* helperTool = "/bin/ln"; if (AuthorizationExecuteWithPrivileges(auth, helperTool, kAuthorizationFlagDefaults, (char**)arguments, NULL) == errAuthorizationSuccess) { int status;