From 8a4578fe4d66faef2579f6678ba5cc6cb995b79e Mon Sep 17 00:00:00 2001 From: Vera Tkachenko Date: Fri, 26 Apr 2013 20:11:18 +0300 Subject: [PATCH] Add ability to override update installation process. --- SUBasicUpdateDriver.m | 8 ++++++++ SUUpdater.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/SUBasicUpdateDriver.m b/SUBasicUpdateDriver.m index 81898190..c84b66b7 100644 --- a/SUBasicUpdateDriver.m +++ b/SUBasicUpdateDriver.m @@ -375,6 +375,14 @@ NSArray *SUGetAllDevMateURLHosts(void) if ([[updater delegate] respondsToSelector:@selector(updater:willInstallUpdate:)]) [[updater delegate] updater:updater willInstallUpdate:updateItem]; + + if ([[updater delegate] respondsToSelector:@selector(updater:overrideInstallUpdate:downloadPath:)]) + { + if ([[updater delegate] updater:updater overrideInstallUpdate:updateItem downloadPath:tempDir]) + { + return; + } + } // Copy the relauncher into a temporary directory so we can get to it after the new version's installed. NSString *relaunchPathToCopy = [SPARKLE_BUNDLE pathForResource:@"finish_installation" ofType:@"app"]; diff --git a/SUUpdater.h b/SUUpdater.h index 2fef07a9..1dd77a7d 100644 --- a/SUUpdater.h +++ b/SUUpdater.h @@ -110,6 +110,9 @@ // Sent immediately before installing the specified update. - (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update; +// Override to handle update manually +- (BOOL)updater:(SUUpdater *)updater overrideInstallUpdate:(SUAppcastItem *)update downloadPath:(NSString *)downloadPath; + // Return YES to delay the relaunch until you do some processing; invoke the given NSInvocation to continue. // This is not called if the user didn't relaunch on the previous update, in that case it will immediately // restart.