From 87da4cc0f2d953b36044ed03fe9c5dd9fd3a7cbb Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 4 May 2015 22:49:57 -0400 Subject: [PATCH] Distinguish between install path found and update being a package --- Sparkle/SUBasicUpdateDriver.m | 8 +++++++- Sparkle/SUInstaller.h | 2 +- Sparkle/SUInstaller.m | 7 ------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index 81311ee7..43978fc7 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -228,8 +228,14 @@ return NO; } - NSString *newBundlePath = [SUInstaller appPathInUpdateFolder:extractedPath forHost:self.host]; + BOOL isPackage = NO; + NSString *newBundlePath = [SUInstaller installSourcePathInUpdateFolder:extractedPath forHost:self.host isPackage:&isPackage isGuided:NULL]; if (!newBundlePath) { + SULog(@"No suitable install is found in the update. The update will be rejected."); + return NO; + } + + if (isPackage) { return canValidateByDSASignature; } diff --git a/Sparkle/SUInstaller.h b/Sparkle/SUInstaller.h index fe82f885..153f3d42 100644 --- a/Sparkle/SUInstaller.h +++ b/Sparkle/SUInstaller.h @@ -15,7 +15,7 @@ @class SUHost; @interface SUInstaller : NSObject -+ (NSString *)appPathInUpdateFolder:(NSString *)updateFolder forHost:(SUHost *)host; ++ (NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(BOOL *)isGuidedPtr; + (void)installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath versionComparator:(id)comparator completionHandler:(void (^)(NSError *))completionHandler; + (void)finishInstallationToPath:(NSString *)installationPath withResult:(BOOL)result error:(NSError *)error completionHandler:(void (^)(NSError *))completionHandler; + (NSString *)updateFolder; diff --git a/Sparkle/SUInstaller.m b/Sparkle/SUInstaller.m index 2513973a..83b8d610 100644 --- a/Sparkle/SUInstaller.m +++ b/Sparkle/SUInstaller.m @@ -121,13 +121,6 @@ static NSString *sUpdateFolder = nil; return newAppDownloadPath; } -+ (NSString *)appPathInUpdateFolder:(NSString *)updateFolder forHost:(SUHost *)host -{ - BOOL isPackage = NO; - NSString *path = [self installSourcePathInUpdateFolder:updateFolder forHost:host isPackage:&isPackage isGuided:nil]; - return isPackage ? nil : path; -} - + (void)installFromUpdateFolder:(NSString *)inUpdateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath versionComparator:(id)comparator completionHandler:(void (^)(NSError *))completionHandler { BOOL isPackage = NO;