mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
Avoid copying the installer to a temporary location
This commit is contained in:
1 parent
70cc3ea360
commit
eac55846a8
3 files changed
+7
-19
No files matched your search
@@ -639,8 +639,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
SULog(@"Couldn't remove update folder: %@.", theError);
|
||||
}
|
||||
|
||||
[[NSFileManager defaultManager] removeItemAtPath:[[NSBundle mainBundle] bundlePath] error:NULL];
|
||||
|
||||
exit(status);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,13 +93,8 @@
|
||||
{
|
||||
SUFileManager *fileManager = [SUFileManager defaultManager];
|
||||
|
||||
NSURL *installerURL = [NSURL fileURLWithPath:installerPath];
|
||||
|
||||
NSError *quarantineError = nil;
|
||||
if (![fileManager releaseItemFromQuarantineAtRootURL:installerURL error:&quarantineError]) {
|
||||
// Probably not a fatal error because we are submitting the executable through launchd
|
||||
SULog(@"Failed to release quarantine on installer at %@ with error %@", installerPath, quarantineError);
|
||||
}
|
||||
// No need to release the quarantine for this utility
|
||||
// In fact, we shouldn't because the tool may be located at a path we should not be writing too.
|
||||
|
||||
NSString *hostBundleIdentifier = hostBundle.bundleIdentifier;
|
||||
assert(hostBundleIdentifier != nil);
|
||||
|
||||
Vendored
+5
-10
@@ -378,16 +378,7 @@
|
||||
|
||||
- (void)launchAutoUpdateSilently:(BOOL)silently completion:(void (^)(NSError *_Nullable))completionHandler
|
||||
{
|
||||
// Copy the relauncher into a temporary directory so we can get to it after the new version's installed.
|
||||
// Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems.
|
||||
NSError *relaunchError = nil;
|
||||
NSString *relaunchToolPath = [self copyPathToCacheDirectory:[self.sparkleBundle pathForResource:@""SPARKLE_RELAUNCH_TOOL_NAME ofType:@""] error:&relaunchError];
|
||||
if (relaunchToolPath == nil) {
|
||||
completionHandler(relaunchError);
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy the progress tool as well
|
||||
// Copy the progress tool into a temporary directory so we can get to it as the new version is being installed.
|
||||
NSError *progressToolError = nil;
|
||||
NSString *progressToolPath = [self copyPathToCacheDirectory:[self.sparkleBundle pathForResource:@""SPARKLE_INSTALLER_PROGRESS_TOOL_NAME ofType:@"app"] error:&progressToolError];
|
||||
if (progressToolPath == nil) {
|
||||
@@ -395,6 +386,10 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Grab the installer path. Note we do not have to copy this tool out of where it may be located right now since it's a utility with no dependencies.
|
||||
// Furthermore, we can keep the tool at a place that may not necessarily be writable.
|
||||
NSString *relaunchToolPath = [self.sparkleBundle pathForResource:@""SPARKLE_RELAUNCH_TOOL_NAME ofType:@""];
|
||||
|
||||
id<SUInstallerLauncherProtocol> installerLauncher = nil;
|
||||
__block BOOL retrievedLaunchStatus = NO;
|
||||
NSXPCConnection *launcherConnection = nil;
|
||||
|
||||
Reference in new issue
Block a user