Permalink
Browse files

Fixing a merge error which put finish_installation in /tmp rather tha…

…n in ~/Library/App Support
  • Loading branch information...
1 parent fa67107 commit 86b6502342286b5595dc120728dbf1226f385886 @andymatuschak andymatuschak committed May 10, 2011
Showing with 19 additions and 13 deletions.
  1. +3 −13 SUBasicUpdateDriver.m
  2. +1 −0 SUHost.h
  3. +15 −0 SUHost.m
View
@@ -152,24 +152,14 @@ - (void)download:(NSURLDownload *)d decideDestinationWithSuggestedFilename:(NSSt
NSString *downloadFileName = [NSString stringWithFormat:@"%@ %@", [host name], [updateItem versionString]];
- NSArray *appSupportPaths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
- NSString *appSupportPath = nil;
- if (!appSupportPaths || [appSupportPaths count] == 0)
- {
- SULog(@"Failed to find app support directory! Using ~/Library/Application Support...");
- appSupportPath = [@"~/Library/Application Support" stringByExpandingTildeInPath];
- }
- else
- appSupportPath = [appSupportPaths objectAtIndex:0];
- appSupportPath = [appSupportPath stringByAppendingPathComponent:[host name]];
[tempDir release];
- tempDir = [[appSupportPath stringByAppendingPathComponent:downloadFileName] retain];
+ tempDir = [[[host appSupportPath] stringByAppendingPathComponent:downloadFileName] retain];
int cnt=1;
while ([[NSFileManager defaultManager] fileExistsAtPath:tempDir] && cnt <= 999)
{
[tempDir release];
- tempDir = [[appSupportPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@ %d", downloadFileName, cnt++]] retain];
+ tempDir = [[[host appSupportPath] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@ %d", downloadFileName, cnt++]] retain];
}
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
@@ -270,7 +260,7 @@ - (void)installUpdate
// 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"];
- NSString *targetPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];
+ NSString *targetPath = [[host appSupportPath] stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];
// 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
View
@@ -21,6 +21,7 @@
- (id)initWithBundle:(NSBundle *)aBundle;
- (NSBundle *)bundle;
- (NSString *)bundlePath;
+- (NSString *)appSupportPath;
- (NSString *)installationPath;
- (NSString *)name;
- (NSString *)version;
View
@@ -46,6 +46,21 @@ - (NSString *)bundlePath
return [bundle bundlePath];
}
+- (NSString *)appSupportPath
+{
+ NSArray *appSupportPaths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
+ NSString *appSupportPath = nil;
+ if (!appSupportPaths || [appSupportPaths count] == 0)
+ {
+ SULog(@"Failed to find app support directory! Using ~/Library/Application Support...");
+ appSupportPath = [@"~/Library/Application Support" stringByExpandingTildeInPath];
+ }
+ else
+ appSupportPath = [appSupportPaths objectAtIndex:0];
+ appSupportPath = [appSupportPath stringByAppendingPathComponent:[self name]];
+ return appSupportPath;
+}
+
- (NSString *)installationPath
{
#if NORMALIZE_INSTALLED_APP_NAME

0 comments on commit 86b6502

Please sign in to comment.