From 8b3d15b3060fb38054697b0de3a9b2cc9ecdfcb3 Mon Sep 17 00:00:00 2001 From: Andy Matuschak Date: Fri, 30 May 2008 21:51:34 -0700 Subject: [PATCH] Moved the check for whether the host is running from a disk image to SUBasicUpdateDriver so that all drivers could take advantage of this check. --- SUBasicUpdateDriver.m | 7 +++++++ SUUserInitiatedUpdateDriver.m | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/SUBasicUpdateDriver.m b/SUBasicUpdateDriver.m index 644f2747..d577e885 100644 --- a/SUBasicUpdateDriver.m +++ b/SUBasicUpdateDriver.m @@ -14,6 +14,13 @@ - (void)checkForUpdatesAtURL:(NSURL *)appcastURL hostBundle:(NSBundle *)hb { hostBundle = [hb retain]; + + if ([hostBundle isRunningFromDiskImage]) + { + [self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:SULocalizedString(@"%1$@ can't be updated when it's running from a disk image. Move %1$@ to your Applications folder, relaunch it, and try again.", nil), [hostBundle name]] forKey:NSLocalizedDescriptionKey]]]; + return; + } + SUAppcast *appcast = [[SUAppcast alloc] init]; CFRetain(appcast); // We'll manage the appcast's memory ourselves so we don't have to make it an IV to support GC. [appcast release]; diff --git a/SUUserInitiatedUpdateDriver.m b/SUUserInitiatedUpdateDriver.m index 4dce586a..a28742f8 100644 --- a/SUUserInitiatedUpdateDriver.m +++ b/SUUserInitiatedUpdateDriver.m @@ -14,11 +14,6 @@ - (void)checkForUpdatesAtURL:(NSURL *)appcastURL hostBundle:(NSBundle *)hb { - if ([hostBundle isRunningFromDiskImage]) - { - [self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:SULocalizedString(@"%1$@ can't be updated when it's running from a disk image. Move %1$@ to your Applications folder, relaunch it, and try again.", nil), [hostBundle name]] forKey:NSLocalizedDescriptionKey]]]; - return; - } [super checkForUpdatesAtURL:appcastURL hostBundle:hb]; }