I don't see installerForHost:error: used anywhere

We can also demote relaunchPath from being an ivar
This commit is contained in:
Zorg committed 2016-03-08 00:22:57 -05:00
1 parent 6f30ae2093
commit 73a0f10010
2 files changed
+6 -21

No files matched your search

-1
View File
@@ -43,7 +43,6 @@
- (void)installWithToolAndRelaunch:(BOOL)relaunch;
- (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI;
- (void)installerForHost:(SUHost *)host failedWithError:(NSError *)error;
- (void)cleanUpDownload;
+6 -20
View File
@@ -38,7 +38,6 @@
@property (strong) SUAppcastItem *nonDeltaUpdateItem;
@property (copy) NSString *tempDir;
@property (copy) NSString *relaunchPath;
@property (nonatomic) BOOL postponedOnce;
@@ -52,7 +51,6 @@
@synthesize nonDeltaUpdateItem;
@synthesize tempDir;
@synthesize relaunchPath;
@synthesize postponedOnce;
@@ -495,6 +493,8 @@
}
NSBundle *sparkleBundle = self.updater.sparkleBundle;
NSString *relaunchPath = nil;
// 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.
@@ -518,7 +518,7 @@
if (![fileManager releaseItemFromQuarantineAtRootURL:targetURL error:&quarantineError]) {
SULog(@"Failed to release quarantine on %@ with error %@", targetPath, quarantineError);
}
self.relaunchPath = targetPath;
relaunchPath = targetPath;
} else {
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:@{
NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil),
@@ -531,12 +531,12 @@
if ([updaterDelegate respondsToSelector:@selector(updaterWillRelaunchApplication:)])
[updaterDelegate updaterWillRelaunchApplication:self.updater];
NSString *relaunchToolPath = [[NSBundle bundleWithPath:self.relaunchPath] executablePath];
if (!relaunchToolPath || ![[NSFileManager defaultManager] fileExistsAtPath:self.relaunchPath]) {
NSString *relaunchToolPath = [[NSBundle bundleWithPath:relaunchPath] executablePath];
if (!relaunchToolPath || ![[NSFileManager defaultManager] fileExistsAtPath:relaunchPath]) {
// Note that we explicitly use the host app's name here, since updating plugin for Mail relaunches Mail, not just the plugin.
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:@{
NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@.", nil), [self.host name]],
NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"Couldn't find the relauncher (expected to find it at %@)", self.relaunchPath]
NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"Couldn't find the relauncher (expected to find it at %@)", relaunchPath]
}]];
// We intentionally don't abandon the update here so that the host won't initiate another.
return;
@@ -612,20 +612,6 @@
self.downloadPath = nil;
}
- (void)installerForHost:(SUHost *)aHost failedWithError:(NSError *)error
{
if (aHost != self.host) {
return;
}
NSError *dontThrow = nil;
[[NSFileManager defaultManager] removeItemAtPath:self.relaunchPath error:&dontThrow]; // Clean up the copied relauncher
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{
NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while installing the update. Please try again later.", nil),
NSLocalizedFailureReasonErrorKey: [error localizedDescription],
NSUnderlyingErrorKey: error,
}]];
}
- (void)abortUpdate
{
[self.updater.userDriver dismissUpdateInstallation];