diff --git a/Configurations/ConfigCommon.xcconfig b/Configurations/ConfigCommon.xcconfig index 8a1d4062..aee99818 100644 --- a/Configurations/ConfigCommon.xcconfig +++ b/Configurations/ConfigCommon.xcconfig @@ -1,13 +1,13 @@ // Common -RELAUNCH_TOOL_PRODUCT_NAME = Autoupdate +FINISH_INSTALL_TOOL_NAME = Autoupdate CURRENT_PROJECT_VERSION = 1.6 GCC_PRECOMPILE_PREFIX_HEADER = YES GCC_PREFIX_HEADER = $(SDKROOT)/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h ARCHS = i386 x86_64 -SPARKLE_COMMON_CFLAGS = -DRELAUNCH_TOOL_PRODUCT_NAME=$(RELAUNCH_TOOL_PRODUCT_NAME) +GCC_PREPROCESSOR_DEFINITIONS = FINISH_INSTALL_TOOL_NAME=$(FINISH_INSTALL_TOOL_NAME) // Enable warnings GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES diff --git a/Configurations/ConfigCommonDebug.xcconfig b/Configurations/ConfigCommonDebug.xcconfig index f190a761..c5f70898 100644 --- a/Configurations/ConfigCommonDebug.xcconfig +++ b/Configurations/ConfigCommonDebug.xcconfig @@ -4,5 +4,5 @@ GCC_OPTIMIZATION_LEVEL = 0 DEBUG_INFORMATION_FORMAT = dwarf GCC_GENERATE_DEBUGGING_SYMBOLS = YES SPARKLE_EXTRA_DEBUG = -DDEBUG -OTHER_CFLAGS = $(SPARKLE_COMMON_CFLAGS) $(SPARKLE_EXTRA_DEBUG) +OTHER_CFLAGS = $(SPARKLE_EXTRA_DEBUG) diff --git a/Configurations/ConfigRelaunch.xcconfig b/Configurations/ConfigRelaunch.xcconfig index b56a3f31..d7e0db00 100644 --- a/Configurations/ConfigRelaunch.xcconfig +++ b/Configurations/ConfigRelaunch.xcconfig @@ -1,4 +1,4 @@ // Relaunch Tool only -PRODUCT_NAME = $(RELAUNCH_TOOL_PRODUCT_NAME) +PRODUCT_NAME = $(FINISH_INSTALL_TOOL_NAME) SKIP_INSTALL = YES diff --git a/SUBasicUpdateDriver.m b/SUBasicUpdateDriver.m index 231c1ec5..3a060b11 100644 --- a/SUBasicUpdateDriver.m +++ b/SUBasicUpdateDriver.m @@ -21,6 +21,15 @@ #import "SUCodeSigningVerifier.h" #import "SUUpdater_Private.h" +#ifdef FINISH_INSTALL_TOOL_NAME + // FINISH_INSTALL_TOOL_NAME expands to unquoted finish_install + #define QUOTE_NS_STRING2(str) @"" #str + #define QUOTE_NS_STRING1(str) QUOTE_NS_STRING2(str) + #define FINISH_INSTALL_TOOL_NAME_STRING QUOTE_NS_STRING1(FINISH_INSTALL_TOOL_NAME) +#else + #error FINISH_INSTALL_TOOL_NAME not defined +#endif + @interface SUBasicUpdateDriver () ; @end @@ -325,14 +334,11 @@ if ([[updater delegate] respondsToSelector:@selector(updater:willInstallUpdate:)]) [[updater delegate] updater:updater willInstallUpdate:updateItem]; - // RELAUNCH_TOOL_PRODUCT_NAME expands to unquoted finish_install - #define NS_STRING_FROM_MACRO(s) NS_STRING_FROM_MACRO_QUOTE_(s) - #define NS_STRING_FROM_MACRO_QUOTE_(s) @"" #s - NSString *relaunchName = NS_STRING_FROM_MACRO(RELAUNCH_TOOL_PRODUCT_NAME); + NSString *const finishInstallToolName = FINISH_INSTALL_TOOL_NAME_STRING; // 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. - NSString *relaunchPathToCopy = [SPARKLE_BUNDLE pathForResource:relaunchName ofType:@"app"]; + NSString *relaunchPathToCopy = [SPARKLE_BUNDLE pathForResource:finishInstallToolName ofType:@"app"]; if (relaunchPathToCopy != nil) { NSString *targetPath = [[host appSupportPath] stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]]; @@ -361,7 +367,7 @@ NSString *pathToRelaunch = [host bundlePath]; if ([[updater delegate] respondsToSelector:@selector(pathToRelaunchForUpdater:)]) pathToRelaunch = [[updater delegate] pathToRelaunchForUpdater:updater]; - NSString *relaunchToolPath = [[relaunchPath stringByAppendingPathComponent: @"/Contents/MacOS"] stringByAppendingPathComponent: relaunchName]; + NSString *relaunchToolPath = [[relaunchPath stringByAppendingPathComponent: @"/Contents/MacOS"] stringByAppendingPathComponent: finishInstallToolName]; [NSTask launchedTaskWithLaunchPath: relaunchToolPath arguments:[NSArray arrayWithObjects: [host bundlePath], pathToRelaunch, diff --git a/SUHost.m b/SUHost.m index fae26cc4..bded0780 100644 --- a/SUHost.m +++ b/SUHost.m @@ -122,20 +122,15 @@ // Use a default icon if none is defined. if (!icon) { BOOL isMainBundle = (bundle == [NSBundle mainBundle]); - - // Starting with 10.6, iconForFileType: accepts a UTI. - NSString *fileType = nil; - if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_5) - fileType = isMainBundle ? NSFileTypeForHFSTypeCode(kGenericApplicationIcon) : @".bundle"; - else - fileType = isMainBundle ? (NSString*)kUTTypeApplication : (NSString*)kUTTypeBundle; + + NSString *fileType = isMainBundle ? (NSString*)kUTTypeApplication : (NSString*)kUTTypeBundle; icon = [[NSWorkspace sharedWorkspace] iconForFileType:fileType]; } return icon; } - (BOOL)isRunningOnReadOnlyVolume -{ +{ struct statfs statfs_info; statfs([[bundle bundlePath] fileSystemRepresentation], &statfs_info); return (statfs_info.f_flags & MNT_RDONLY); diff --git a/SUPlainInstallerInternals.m b/SUPlainInstallerInternals.m index ef8693e2..6c4e16eb 100644 --- a/SUPlainInstallerInternals.m +++ b/SUPlainInstallerInternals.m @@ -472,62 +472,36 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza } err = FSPathMakeRef((UInt8 *)[[dst stringByDeletingLastPathComponent] fileSystemRepresentation], &dstDirRef, NULL); - + if (err == noErr && hadFileAtDest) - { - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) - { - NSFileManager *manager = [[[NSFileManager alloc] init] autorelease]; - BOOL success = [manager moveItemAtPath:dst toPath:tmpPath error:error]; - if (!success && hadFileAtDest) - { - if (error != NULL) - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath] forKey:NSLocalizedDescriptionKey]]; - return NO; - } - - } else { - err = FSMoveObjectSync(&dstRef, &tmpDirRef, (CFStringRef)[tmpPath lastPathComponent], &movedRef, 0); - if (err != noErr && hadFileAtDest) - { - if (error != NULL) - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath] forKey:NSLocalizedDescriptionKey]]; - return NO; - } - } + { + NSFileManager *manager = [[[NSFileManager alloc] init] autorelease]; + BOOL success = [manager moveItemAtPath:dst toPath:tmpPath error:error]; + if (!success && hadFileAtDest) + { + if (error != NULL) + *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath] forKey:NSLocalizedDescriptionKey]]; + return NO; + } } - + err = FSPathMakeRef((UInt8 *)[src fileSystemRepresentation], &srcRef, NULL); if (err == noErr) { - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) + NSFileManager *manager = [[[NSFileManager alloc] init] autorelease]; + BOOL success = [manager copyItemAtPath:src toPath:dst error:error]; + if (!success) { - NSFileManager *manager = [[[NSFileManager alloc] init] autorelease]; - BOOL success = [manager copyItemAtPath:src toPath:dst error:error]; - if (!success) - { - // We better move the old version back to its old location - if( hadFileAtDest ) - success = [manager moveItemAtPath:tmpPath toPath:dst error:error]; - if (!success && error != NULL) - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath] forKey:NSLocalizedDescriptionKey]]; - return NO; + // We better move the old version back to its old location + if( hadFileAtDest ) + success = [manager moveItemAtPath:tmpPath toPath:dst error:error]; + if (!success && error != NULL) + *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath] forKey:NSLocalizedDescriptionKey]]; + return NO; - } - } else { - err = FSCopyObjectSync(&srcRef, &dstDirRef, (CFStringRef)[dst lastPathComponent], NULL, 0); - if (err != noErr) - { - // We better move the old version back to its old location - if( hadFileAtDest ) - FSMoveObjectSync(&movedRef, &dstDirRef, (CFStringRef)[dst lastPathComponent], &movedRef, 0); - if (error != NULL) - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't copy %@ to %@.", src, dst] forKey:NSLocalizedDescriptionKey]]; - return NO; - } } } - + // If the currently-running application is trusted, the new // version should be trusted as well. Remove it from the // quarantine to avoid a delay at launch, and to avoid diff --git a/SUUpdateAlert.m b/SUUpdateAlert.m index a2bd6b11..c35f4e13 100644 --- a/SUUpdateAlert.m +++ b/SUUpdateAlert.m @@ -94,8 +94,14 @@ { // Set the default font [releaseNotesView setPreferencesIdentifier:[SPARKLE_BUNDLE bundleIdentifier]]; - [[releaseNotesView preferences] setStandardFontFamily:[[NSFont systemFontOfSize:8] familyName]]; - [[releaseNotesView preferences] setDefaultFontSize:(int)[NSFont systemFontSizeForControlSize:NSSmallControlSize]]; + WebPreferences *prefs = [releaseNotesView preferences]; + NSString *familyName = [[NSFont systemFontOfSize:8] familyName]; + if ([familyName hasPrefix:@"."]) { // 10.9 returns ".Lucida Grande UI", which isn't a valid name for the WebView + familyName = @"Lucida Grande"; + } + [prefs setStandardFontFamily:familyName]; + [prefs setDefaultFontSize:(int)[NSFont systemFontSizeForControlSize:NSSmallControlSize]]; + [prefs setPlugInsEnabled:NO]; [releaseNotesView setFrameLoadDelegate:self]; [releaseNotesView setPolicyDelegate:self]; diff --git a/Sparkle.icns b/Sparkle.icns index e690be2a..ac96d1b2 100644 Binary files a/Sparkle.icns and b/Sparkle.icns differ