From 4fad53007f3b5c346d3335ed5e9dccb04f4423ea Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Tue, 1 Sep 2009 20:10:16 -0700 Subject: [PATCH] Change availability checks so that they build on 10.4 --- SUAppcast.m | 4 ++-- SUBasicUpdateDriver.m | 6 +++--- SUPipedUnarchiver.m | 2 +- SUUIBasedUpdateDriver.m | 2 +- relaunch.m | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/SUAppcast.m b/SUAppcast.m index 51195f7fb..32bc03cd0 100644 --- a/SUAppcast.m +++ b/SUAppcast.m @@ -59,7 +59,7 @@ - (void)downloadDidFinish:(NSURLDownload *)download BOOL failed = NO; NSArray *xmlItems = nil; NSMutableArray *appcastItems = [NSMutableArray array]; -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 +#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 [[NSFileManager defaultManager] removeFileAtPath:downloadFilename handler:nil]; #else [[NSFileManager defaultManager] removeItemAtPath:downloadFilename error:NULL]; @@ -179,7 +179,7 @@ - (void)downloadDidFinish:(NSURLDownload *)download - (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error { CFRelease(download); -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 +#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 [[NSFileManager defaultManager] removeFileAtPath:downloadFilename handler:nil]; #else [[NSFileManager defaultManager] removeItemAtPath:downloadFilename error:NULL]; diff --git a/SUBasicUpdateDriver.m b/SUBasicUpdateDriver.m index dd992e16a..6f109ea93 100644 --- a/SUBasicUpdateDriver.m +++ b/SUBasicUpdateDriver.m @@ -146,7 +146,7 @@ - (void)download:(NSURLDownload *)d decideDestinationWithSuggestedFilename:(NSSt tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@ %d", prefix, cnt++]]; } -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 +#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:tempDir attributes:nil]; #else BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:tempDir withIntermediateDirectories:YES attributes:nil error:NULL]; @@ -231,7 +231,7 @@ - (void)installUpdate NSString *targetPath = [NSTemporaryDirectory() 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_5 +#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 @@ -289,7 +289,7 @@ - (void)relaunchHostApp - (void)cleanUp { -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 +#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 [[NSFileManager defaultManager] removeFileAtPath:[downloadPath stringByDeletingLastPathComponent] handler:nil]; #else [[NSFileManager defaultManager] removeItemAtPath:[downloadPath stringByDeletingLastPathComponent] error:NULL]; diff --git a/SUPipedUnarchiver.m b/SUPipedUnarchiver.m index ec5f5b00b..db7ffc99a 100644 --- a/SUPipedUnarchiver.m +++ b/SUPipedUnarchiver.m @@ -48,7 +48,7 @@ - (void)_extractArchivePipingDataToCommand:(NSString *)command FILE *fp = NULL, *cmdFP = NULL; // Get the file size. -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 +#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 NSNumber *fs = [[[NSFileManager defaultManager] fileAttributesAtPath:archivePath traverseLink:NO] objectForKey:NSFileSize]; #else NSNumber *fs = [[[NSFileManager defaultManager] attributesOfItemAtPath:archivePath error:NULL] objectForKey:NSFileSize]; diff --git a/SUUIBasedUpdateDriver.m b/SUUIBasedUpdateDriver.m index dd32a7407..3fe001edd 100644 --- a/SUUIBasedUpdateDriver.m +++ b/SUUIBasedUpdateDriver.m @@ -122,7 +122,7 @@ - (void)unarchiver:(SUUnarchiver *)ua extractedLength:(long)length { // We do this here instead of in extractUpdate so that we only have a determinate progress bar for archives with progress. if ([statusController maxProgressValue] == 0) -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 +#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 [statusController setMaxProgressValue:[[[[NSFileManager defaultManager] fileAttributesAtPath:downloadPath traverseLink:NO] objectForKey:NSFileSize] doubleValue]]; #else [statusController setMaxProgressValue:[[[[NSFileManager defaultManager] attributesOfItemAtPath:downloadPath error:NULL] objectForKey:NSFileSize] doubleValue]]; diff --git a/relaunch.m b/relaunch.m index 1bc87543c..e693e3776 100644 --- a/relaunch.m +++ b/relaunch.m @@ -39,7 +39,7 @@ - (void)watchdog:(NSTimer *)timer - (void) relaunch { [[NSWorkspace sharedWorkspace] openFile:[[NSFileManager defaultManager] stringWithFileSystemRepresentation:executablePath length:strlen(executablePath)]]; -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 +#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 [[NSFileManager defaultManager] removeFileAtPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"relaunch"] handler:nil]; #else [[NSFileManager defaultManager] removeItemAtPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"relaunch"] error:NULL];