File tree 2 files changed +12
-6
lines changed
2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -40,10 +40,16 @@ - (void)relaunch:(id)sender;
40
40
NSString *processID = [NSString stringWithFormat: @" %d " , [[NSProcessInfo processInfo ] processIdentifier ]];
41
41
42
42
NSError *error = NULL ;
43
- [[NSFileManager defaultManager ] removeItemAtPath: launcherTarget error: &error];
44
- Check (error);
45
- [[NSFileManager defaultManager ] copyItemAtPath: launcherSource toPath: launcherTarget error: &error];
46
- Check (error);
43
+ BOOL success = YES ;
44
+
45
+ success = [[NSFileManager defaultManager ] removeItemAtPath: launcherTarget error: &error];
46
+ if (!success) {
47
+ // Code 4: "The operation couldn’t be completed. No such file or directory"
48
+ Check (error.code == 4 );
49
+ }
50
+
51
+ success = [[NSFileManager defaultManager ] copyItemAtPath: launcherSource toPath: launcherTarget error: &error];
52
+ Check (success);
47
53
48
54
[NSTask launchedTaskWithLaunchPath: launcherTarget arguments: @[appPath, processID]];
49
55
[NSApp terminate: sender];
Original file line number Diff line number Diff line change 16
16
17
17
@interface SWTerminationListener : NSObject
18
18
19
- - (id ) initWithExecutablePath : (const char *)execPath parentProcessId : (pid_t )ppid ;
20
- - (void ) relaunch ;
19
+ - (id )initWithExecutablePath : (const char *)execPath parentProcessId : (pid_t )ppid ;
20
+ - (void )relaunch ;
21
21
22
22
@end
You can’t perform that action at this time.
0 commit comments