diff --git a/Autoupdate/AppInstaller.m b/Autoupdate/AppInstaller.m index 23df75f3..0a022924 100644 --- a/Autoupdate/AppInstaller.m +++ b/Autoupdate/AppInstaller.m @@ -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); } diff --git a/InstallerLauncher/SUInstallerLauncher.m b/InstallerLauncher/SUInstallerLauncher.m index b04e0aa6..abe56f4a 100644 --- a/InstallerLauncher/SUInstallerLauncher.m +++ b/InstallerLauncher/SUInstallerLauncher.m @@ -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); diff --git a/Sparkle/SUInstallerDriver.m b/Sparkle/SUInstallerDriver.m index 3aeed79d..24396279 100644 --- a/Sparkle/SUInstallerDriver.m +++ b/Sparkle/SUInstallerDriver.m @@ -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 installerLauncher = nil; __block BOOL retrievedLaunchStatus = NO; NSXPCConnection *launcherConnection = nil;