mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
commit
d4d984f42c
8 files changed
+48
-67
No files matched your search
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Relaunch Tool only
|
||||
|
||||
PRODUCT_NAME = $(RELAUNCH_TOOL_PRODUCT_NAME)
|
||||
PRODUCT_NAME = $(FINISH_INSTALL_TOOL_NAME)
|
||||
SKIP_INSTALL = YES
|
||||
+12
-6
@@ -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 () <NSURLDownloadDelegate>; @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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
+21
-47
@@ -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
|
||||
|
||||
+8
-2
@@ -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];
|
||||
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user