From 67d53c04b796f987570ae5cd4db76a7e24174895 Mon Sep 17 00:00:00 2001 From: Uli Kusterer Date: Tue, 3 May 2011 11:05:37 +0200 Subject: [PATCH] Get rid of deprecation warnings on 10.6/Xcode 4 while still allowing to build for 10.4 compatibility (I hear Patrick needs that). --- SUBasicUpdateDriver.m | 7 ++++++- SUUIBasedUpdateDriver.m | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/SUBasicUpdateDriver.m b/SUBasicUpdateDriver.m index 0614a0c2..f2b5dd0c 100644 --- a/SUBasicUpdateDriver.m +++ b/SUBasicUpdateDriver.m @@ -336,7 +336,12 @@ - (void)installerForHost:(SUHost *)aHost failedWithError:(NSError *)error { if (aHost != host) { return; } - [[NSFileManager defaultManager] removeFileAtPath:relaunchPath handler:NULL]; // Clean up the copied relauncher. +#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 + [[NSFileManager defaultManager] removeFileAtPath: relaunchPath handler: nil]; // Clean up the copied relauncher +#else + NSError * dontThrow = nil; + [[NSFileManager defaultManager] removeItemAtPath: relaunchPath error: &dontThrow]; // Clean up the copied relauncher +#endif [self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while installing the update. Please try again later.", nil), NSLocalizedDescriptionKey, [error localizedDescription], NSLocalizedFailureReasonErrorKey, nil]]]; } diff --git a/SUUIBasedUpdateDriver.m b/SUUIBasedUpdateDriver.m index eb17f028..aac85293 100644 --- a/SUUIBasedUpdateDriver.m +++ b/SUUIBasedUpdateDriver.m @@ -125,7 +125,14 @@ [self abortUpdate]; if (tempDir != nil) // tempDir contains downloadPath, so we implicitly delete both here. { - if( ![[NSFileManager defaultManager] removeFileAtPath: tempDir handler: nil] ) + BOOL success = NO; +#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 + success = [[NSFileManager defaultManager] removeFileAtPath: tempDir handler: nil]; // Clean up the copied relauncher +#else + NSError * error = nil; + success = [[NSFileManager defaultManager] removeItemAtPath: tempDir error: &error]; // Clean up the copied relauncher +#endif + if( !success ) [[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:[tempDir stringByDeletingLastPathComponent] destination:@"" files:[NSArray arrayWithObject:[tempDir lastPathComponent]] tag:NULL]; } }