Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make Sparkle more robust when the permissions of ~/Library/Applicatio…

…n Support/EyeTV are screwed up. We now authenticate if needed, when we copy the finish_installation tool.
  • Loading branch information...
commit 7cd8974b7e0635e0ca530c6eb74893303d04c02b 1 parent 9c042a5
@uliwitness uliwitness authored
Showing with 4 additions and 8 deletions.
  1. +4 −8 SUBasicUpdateDriver.m
View
12 SUBasicUpdateDriver.m
@@ -15,6 +15,8 @@
#import "SUUnarchiver.h"
#import "SUConstants.h"
#import "SULog.h"
+#import "SUPlainInstaller.h"
+#import "SUPlainInstallerInternals.h"
@implementation SUBasicUpdateDriver
@@ -235,7 +237,7 @@ - (void)installUpdate
if ([[updater delegate] respondsToSelector:@selector(updater:willInstallUpdate:)])
[[updater delegate] updater:updater willInstallUpdate:updateItem];
// Copy the relauncher into a temporary directory so we can get to it after the new version's installed.
- NSString *relaunchPathToCopy = [[NSBundle bundleForClass:[self class]] pathForResource:@"finish_installation" ofType:@"app"];
+ NSString *relaunchPathToCopy = [[NSBundle bundleForClass:[self class]] pathForResource:@"finish_installation" ofType:@"app"];
NSString *appSupportFolder = [[@"~/Library/Application Support/" stringByExpandingTildeInPath] stringByAppendingPathComponent: [host name]];
NSString *targetPath = [appSupportFolder stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
@@ -246,13 +248,7 @@ - (void)installUpdate
// Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems.
NSError *error = nil;
-#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
- [[NSFileManager defaultManager] removeFileAtPath:targetPath handler:nil];
- if ([[NSFileManager defaultManager] copyPath:relaunchPathToCopy toPath:targetPath handler:nil])
-#else
- [[NSFileManager defaultManager] removeItemAtPath:targetPath error:NULL];
- if ([[NSFileManager defaultManager] copyItemAtPath:relaunchPathToCopy toPath:targetPath error:&error])
-#endif
+ if( [SUPlainInstaller copyPathWithAuthentication: relaunchPathToCopy overPath: targetPath temporaryName: nil error: &error] )
relaunchPath = [targetPath retain];
else
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil), NSLocalizedDescriptionKey, [NSString stringWithFormat:@"Couldn't copy relauncher (%@) to temporary path (%@)! %@", relaunchPathToCopy, targetPath, (error ? [error localizedDescription] : @"")], NSLocalizedFailureReasonErrorKey, nil]]];
Please sign in to comment.
Something went wrong with that request. Please try again.