mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Actually works now, but leaves one leftover copy of relaunch in NSTemporaryDirectory()
This commit is contained in:
1 parent
c722b09ba6
commit
f1198d8167
2 files changed
+2
-10
No files matched your search
@@ -185,16 +185,6 @@
|
||||
realRelauncherPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"relaunch" ofType:@""];
|
||||
|
||||
[NSTask launchedTaskWithLaunchPath:realRelauncherPath arguments:[NSArray arrayWithObjects:[hostBundle bundlePath], [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]], nil]];
|
||||
|
||||
//if there's a possibility that a copy of relauncher is in NSTemporaryDirectory(), we need to be sure to clean it up
|
||||
if(relaunchPath)
|
||||
{
|
||||
[[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation
|
||||
source:[relaunchPath stringByDeletingLastPathComponent]
|
||||
destination:@""
|
||||
files:[NSArray arrayWithObject:[relaunchPath lastPathComponent]]
|
||||
tag:NULL];
|
||||
}
|
||||
}
|
||||
@catch (NSException *e)
|
||||
{
|
||||
|
||||
@@ -58,6 +58,8 @@ NSString *SUInstallerDelegateKey = @"SUInstallerDelegate";
|
||||
{
|
||||
NSString *relaunchPathToCopy = [[NSBundle bundleForClass:[self class]] pathForResource:@"relaunch" ofType:@""];
|
||||
NSString *targetPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];
|
||||
//Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems
|
||||
[[NSFileManager defaultManager] removeFileAtPath:targetPath handler:nil];
|
||||
if([[NSFileManager defaultManager] copyPath:relaunchPathToCopy toPath:targetPath handler:nil])
|
||||
*relaunchPath = targetPath;
|
||||
|
||||
|
||||
Reference in new issue
Block a user