From 84b7e5e22fa81636e63c05a92a4449ba7f5fe4fb Mon Sep 17 00:00:00 2001 From: Kornel Date: Sat, 27 May 2017 11:38:19 +0100 Subject: [PATCH] Prepend app name to Autoupdate.app name --- Sparkle/SUBasicUpdateDriver.m | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index d5842622..bd96b515 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -499,22 +499,29 @@ // 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. - NSString *const relaunchToolName = @"" SPARKLE_RELAUNCH_TOOL_NAME; - NSString *const relaunchToolSourcePath = [sparkleBundle pathForResource:relaunchToolName ofType:@"app"]; + NSString *const relaunchToolSourceName = @"" SPARKLE_RELAUNCH_TOOL_NAME; + NSString *const relaunchToolSourcePath = [sparkleBundle pathForResource:relaunchToolSourceName ofType:@"app"]; NSString *relaunchCopyTargetPath = nil; NSError *error = nil; BOOL copiedRelaunchPath = NO; - if (!relaunchToolName) { + if (!relaunchToolSourceName || ![relaunchToolSourceName length]) { SULog(SULogLevelError, @"SPARKLE_RELAUNCH_TOOL_NAME not configued"); } if (!relaunchToolSourcePath) { - SULog(SULogLevelError, @"Sparkle.framework is damaged. %@ is missing", relaunchToolName); + SULog(SULogLevelError, @"Sparkle.framework is damaged. %@ is missing", relaunchToolSourceName); } if (relaunchToolSourcePath) { - relaunchCopyTargetPath = [[self appCachePath] stringByAppendingPathComponent:[relaunchToolSourcePath lastPathComponent]]; + NSString *hostBundleBaseName = [[self.host.bundlePath lastPathComponent] stringByDeletingPathExtension]; + if (!hostBundleBaseName) { + SULog(SULogLevelError, @"Unable to get bundlePath"); + hostBundleBaseName = @"Sparkle"; + } + NSString *relaunchCopyBaseName = [NSString stringWithFormat:@"%@ (Autoupdate).app", hostBundleBaseName]; + + relaunchCopyTargetPath = [[self appCachePath] stringByAppendingPathComponent:relaunchCopyBaseName]; SUFileManager *fileManager = [SUFileManager defaultManager];