OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/installer/gcapi_mac/gcapi.h" | 5 #include "chrome/installer/gcapi_mac/gcapi.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 #include <grp.h> | 8 #include <grp.h> |
9 #include <pwd.h> | 9 #include <pwd.h> |
10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // Don't use Objective-C 2 loop syntax, in case an installer runs on 10.4. | 101 // Don't use Objective-C 2 loop syntax, in case an installer runs on 10.4. |
102 NSMutableArray* keystone_paths = | 102 NSMutableArray* keystone_paths = |
103 [NSMutableArray arrayWithObject:kSystemKsadminPath]; | 103 [NSMutableArray arrayWithObject:kSystemKsadminPath]; |
104 if (kind == kUserTicket) { | 104 if (kind == kUserTicket) { |
105 [keystone_paths insertObject:AdjustHomedir(kUserKsadminPath, user->pw_dir) | 105 [keystone_paths insertObject:AdjustHomedir(kUserKsadminPath, user->pw_dir) |
106 atIndex:0]; | 106 atIndex:0]; |
107 } | 107 } |
108 NSEnumerator* e = [keystone_paths objectEnumerator]; | 108 NSEnumerator* e = [keystone_paths objectEnumerator]; |
109 id ks_path; | 109 id ks_path; |
110 while ((ks_path = [e nextObject])) { | 110 while ((ks_path = [e nextObject])) { |
| 111 if (![[NSFileManager defaultManager] fileExistsAtPath:ks_path]) |
| 112 continue; |
| 113 |
111 NSTask* task = nil; | 114 NSTask* task = nil; |
112 NSString* string = nil; | 115 NSString* string = nil; |
113 bool ksadmin_ran_successfully = false; | 116 bool ksadmin_ran_successfully = false; |
114 | 117 |
115 @try { | 118 @try { |
116 task = [[NSTask alloc] init]; | 119 task = [[NSTask alloc] init]; |
117 [task setLaunchPath:ks_path]; | 120 [task setLaunchPath:ks_path]; |
118 | 121 |
119 NSArray* arguments = @[ | 122 NSArray* arguments = @[ |
120 kind == kUserTicket ? @"--user-store" : @"--system-store", | 123 kind == kUserTicket ? @"--user-store" : @"--system-store", |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 return 1; | 361 return 1; |
359 } | 362 } |
360 | 363 |
361 int LaunchGoogleChrome() { | 364 int LaunchGoogleChrome() { |
362 @autoreleasepool { | 365 @autoreleasepool { |
363 // NSWorkspace launches processes as the current console owner, | 366 // NSWorkspace launches processes as the current console owner, |
364 // even when running with euid of 0. | 367 // even when running with euid of 0. |
365 return [[NSWorkspace sharedWorkspace] launchApplication:kChromeInstallPath]; | 368 return [[NSWorkspace sharedWorkspace] launchApplication:kChromeInstallPath]; |
366 } | 369 } |
367 } | 370 } |
OLD | NEW |