mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
Merge commit 'seanm/master'
This commit is contained in:
commit
6c8f094bbe
43 files changed
+307
-281
No files matched your search
@@ -14,6 +14,7 @@ GCC_DEBUGGING_SYMBOLS = full
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES
|
||||
GCC_PREFIX_HEADER = $(SDKROOT)/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h
|
||||
GCC_FAST_OBJC_DISPATCH = YES
|
||||
GCC_ENABLE_PASCAL_STRINGS = NO
|
||||
ARCHS = ppc i386 x86_64
|
||||
|
||||
// Enable warnings
|
||||
@@ -36,4 +37,15 @@ GCC_WARN_UNKNOWN_PRAGMAS = YES
|
||||
GCC_WARN_UNUSED_VARIABLE = YES
|
||||
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES
|
||||
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES
|
||||
WARNING_CFLAGS = -Wall
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES
|
||||
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES
|
||||
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES
|
||||
GCC_WARN_UNUSED_FUNCTION = YES
|
||||
GCC_WARN_UNUSED_LABEL = YES
|
||||
GCC_WARN_UNUSED_VALUE = YES
|
||||
GCC_WARN_UNUSED_PARAMETER = YES
|
||||
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES
|
||||
WARNING_CFLAGS = -Wall -Wundef -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-noreturn -Wmissing-format-attribute -Wpacked -Wredundant-decls -Winline -Wdisabled-optimization -Wformat=2 -Wlarger-than-32768 -Winvalid-pch
|
||||
|
||||
// TODO:
|
||||
// GCC_WARN_UNDECLARED_SELECTOR = YES only 7 warnings
|
||||
@@ -3,5 +3,8 @@
|
||||
GCC_OPTIMIZATION_LEVEL = 0
|
||||
DEBUG_INFORMATION_FORMAT = dwarf
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
|
||||
SPARKLE_EXTRA_DEBUG = -DDEBUG -fstack-protector -D_FORTIFY_SOURCE=2
|
||||
OTHER_CFLAGS = $(SPARKLE_EXTRA_DEBUG)
|
||||
SPARKLE_EXTRA_DEBUG_10_5_ONLY = -fstack-protector -D_FORTIFY_SOURCE=2
|
||||
SPARKLE_EXTRA_DEBUG = -DDEBUG
|
||||
OTHER_CFLAGS = $(SPARKLE_EXTRA_DEBUG)
|
||||
|
||||
// Add $(SPARKLE_EXTRA_DEBUG_10_5_ONLY) to SPARKLE_EXTRA_DEBUG if your deployment is 10.5 or greater.
|
||||
@@ -0,0 +1,9 @@
|
||||
// Unit Test only
|
||||
|
||||
INFOPLIST_FILE = Tests/Sparkle Unit Tests-Info.plist
|
||||
OTHER_LDFLAGS = -framework Cocoa -framework SenTestingKit
|
||||
PRODUCT_NAME = Sparkle Unit Tests
|
||||
WRAPPER_EXTENSION = octest
|
||||
FRAMEWORK_SEARCH_PATHS = $(DEVELOPER_LIBRARY_DIR)/Frameworks
|
||||
GCC_PREFIX_HEADER = $(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES
|
||||
@@ -0,0 +1,3 @@
|
||||
#include "ConfigCommon.xcconfig"
|
||||
#include "ConfigCommonDebug.xcconfig"
|
||||
#include "ConfigUnitTest.xcconfig"
|
||||
@@ -0,0 +1,3 @@
|
||||
#include "ConfigCommon.xcconfig"
|
||||
#include "ConfigCommonRelease.xcconfig"
|
||||
#include "ConfigUnitTest.xcconfig"
|
||||
@@ -0,0 +1,3 @@
|
||||
#include "ConfigUnitTestRelease.xcconfig"
|
||||
|
||||
GCC_ENABLE_OBJC_GC = required
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
@interface NTSynchronousTask : NSObject
|
||||
{
|
||||
@private
|
||||
NSTask *mv_task;
|
||||
NSPipe *mv_outputPipe;
|
||||
NSPipe *mv_inputPipe;
|
||||
|
||||
+10
-15
@@ -56,10 +56,10 @@
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
[self setTask:nil];
|
||||
[self setOutputPipe:nil];
|
||||
[self setInputPipe:nil];
|
||||
[self setOutput:nil];
|
||||
[mv_task release];
|
||||
[mv_outputPipe release];
|
||||
[mv_inputPipe release];
|
||||
[mv_output release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -70,7 +70,7 @@
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSData* result=nil;
|
||||
|
||||
NS_DURING
|
||||
@try
|
||||
{
|
||||
NTSynchronousTask* task = [[NTSynchronousTask alloc] init];
|
||||
|
||||
@@ -81,8 +81,7 @@
|
||||
|
||||
[task release];
|
||||
}
|
||||
NS_HANDLER;
|
||||
NS_ENDHANDLER;
|
||||
@catch (NSException *localException) { }
|
||||
|
||||
[pool drain];
|
||||
|
||||
@@ -92,10 +91,6 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NTSynchronousTask (Private)
|
||||
|
||||
- (void)run:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
|
||||
{
|
||||
BOOL success = NO;
|
||||
@@ -118,12 +113,12 @@
|
||||
|
||||
[[[self outputPipe] fileHandleForReading] readToEndOfFileInBackgroundAndNotifyForModes:[NSArray arrayWithObjects:NSDefaultRunLoopMode, NSModalPanelRunLoopMode, NSEventTrackingRunLoopMode, nil]];
|
||||
|
||||
NS_DURING
|
||||
@try
|
||||
{
|
||||
[[self task] launch];
|
||||
success = YES;
|
||||
NS_HANDLER
|
||||
;
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
@catch (NSException *localException) { }
|
||||
|
||||
if (success)
|
||||
{
|
||||
|
||||
+3
-1
@@ -10,7 +10,9 @@
|
||||
#define SUAPPCAST_H
|
||||
|
||||
@class SUAppcastItem;
|
||||
@interface SUAppcast : NSObject {
|
||||
@interface SUAppcast : NSObject
|
||||
{
|
||||
@private
|
||||
NSArray *items;
|
||||
NSString *userAgentString;
|
||||
id delegate;
|
||||
|
||||
+13
-7
@@ -40,8 +40,12 @@
|
||||
|
||||
- (void)download:(NSURLDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename
|
||||
{
|
||||
NSString *destinationFilename = [NSTemporaryDirectory() stringByAppendingPathComponent:filename];
|
||||
[download setDestination:destinationFilename allowOverwrite:NO];
|
||||
NSString* destinationFilename = NSTemporaryDirectory();
|
||||
if (destinationFilename)
|
||||
{
|
||||
destinationFilename = [destinationFilename stringByAppendingPathComponent:filename];
|
||||
[download setDestination:destinationFilename allowOverwrite:NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)download didCreateDestination:(NSString *)path
|
||||
@@ -52,7 +56,8 @@
|
||||
|
||||
- (void)downloadDidFinish:(NSURLDownload *)download
|
||||
{
|
||||
CFRelease(download);
|
||||
if (download)
|
||||
CFRelease(download);
|
||||
|
||||
NSError *error = nil;
|
||||
NSXMLDocument *document = [[NSXMLDocument alloc] initWithContentsOfURL:[NSURL fileURLWithPath:downloadFilename] options:0 error:&error];
|
||||
@@ -62,7 +67,7 @@
|
||||
#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];
|
||||
[[NSFileManager defaultManager] removeItemAtPath:downloadFilename error:nil];
|
||||
#endif
|
||||
[downloadFilename release];
|
||||
downloadFilename = nil;
|
||||
@@ -179,13 +184,14 @@
|
||||
|
||||
- (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error
|
||||
{
|
||||
CFRelease(download);
|
||||
if (download)
|
||||
CFRelease(download);
|
||||
if (downloadFilename)
|
||||
{
|
||||
#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];
|
||||
[[NSFileManager defaultManager] removeItemAtPath:downloadFilename error:nil];
|
||||
#endif
|
||||
}
|
||||
[downloadFilename release];
|
||||
@@ -219,7 +225,7 @@
|
||||
NSXMLElement *node;
|
||||
NSMutableArray *languages = [NSMutableArray array];
|
||||
NSString *lang;
|
||||
NSInteger i;
|
||||
NSUInteger i;
|
||||
while ((node = [nodeEnum nextObject]))
|
||||
{
|
||||
lang = [[node attributeForName:@"xml:lang"] stringValue];
|
||||
|
||||
+3
-1
@@ -9,7 +9,9 @@
|
||||
#ifndef SUAPPCASTITEM_H
|
||||
#define SUAPPCASTITEM_H
|
||||
|
||||
@interface SUAppcastItem : NSObject {
|
||||
@interface SUAppcastItem : NSObject
|
||||
{
|
||||
@private
|
||||
NSString *title;
|
||||
NSDate *date;
|
||||
NSString *itemDescription;
|
||||
|
||||
+8
-8
@@ -185,14 +185,14 @@
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self setTitle:nil];
|
||||
[self setDate:nil];
|
||||
[self setItemDescription:nil];
|
||||
[self setReleaseNotesURL:nil];
|
||||
[self setDSASignature:nil];
|
||||
[self setFileURL:nil];
|
||||
[self setVersionString:nil];
|
||||
[self setDisplayVersionString:nil];
|
||||
[title release];
|
||||
[date release];
|
||||
[itemDescription release];
|
||||
[releaseNotesURL release];
|
||||
[DSASignature release];
|
||||
[fileURL release];
|
||||
[versionString release];
|
||||
[displayVersionString release];
|
||||
[propertiesDictionary release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
#import "SUBasicUpdateDriver.h"
|
||||
|
||||
@class SUAutomaticUpdateAlert;
|
||||
@interface SUAutomaticUpdateDriver : SUBasicUpdateDriver {
|
||||
@interface SUAutomaticUpdateDriver : SUBasicUpdateDriver
|
||||
{
|
||||
@private
|
||||
BOOL postponingInstallation, showErrors;
|
||||
SUAutomaticUpdateAlert *alert;
|
||||
}
|
||||
|
||||
+25
-20
@@ -94,7 +94,7 @@
|
||||
}
|
||||
|
||||
updateItem = [item retain];
|
||||
CFRelease(ac); // Remember that we're explicitly managing the memory of the appcast.
|
||||
if (ac) { CFRelease(ac); } // Remember that we're explicitly managing the memory of the appcast.
|
||||
if (updateItem == nil) { [self didNotFindUpdate]; return; }
|
||||
|
||||
if ([self itemContainsValidUpdate:updateItem])
|
||||
@@ -105,7 +105,7 @@
|
||||
|
||||
- (void)appcast:(SUAppcast *)ac failedToLoadWithError:(NSError *)error
|
||||
{
|
||||
CFRelease(ac); // Remember that we're explicitly managing the memory of the appcast.
|
||||
if (ac) { CFRelease(ac); } // Remember that we're explicitly managing the memory of the appcast.
|
||||
[self abortUpdateWithError:error];
|
||||
}
|
||||
|
||||
@@ -139,27 +139,31 @@
|
||||
// We create a temporary directory in /tmp and stick the file there.
|
||||
// Not using a GUID here because hdiutil (for DMGs) for some reason chokes on GUIDs. Too long? I really have no idea.
|
||||
NSString *prefix = [NSString stringWithFormat:@"%@ %@ Update", [host name], [host version]];
|
||||
NSString *tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:prefix];
|
||||
int cnt=1;
|
||||
while ([[NSFileManager defaultManager] fileExistsAtPath:tempDir] && cnt <= 999)
|
||||
NSString *tempDir = NSTemporaryDirectory();
|
||||
if (tempDir)
|
||||
{
|
||||
tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@ %d", prefix, cnt++]];
|
||||
}
|
||||
tempDir = [tempDir stringByAppendingPathComponent:prefix];
|
||||
unsigned int cnt=1;
|
||||
while ([[NSFileManager defaultManager] fileExistsAtPath:tempDir] && cnt <= 999)
|
||||
{
|
||||
tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@ %u", prefix, cnt++]];
|
||||
}
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:tempDir attributes:nil];
|
||||
BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:tempDir attributes:nil];
|
||||
#else
|
||||
BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:tempDir withIntermediateDirectories:YES attributes:nil error:NULL];
|
||||
BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:tempDir withIntermediateDirectories:YES attributes:nil error:nil];
|
||||
#endif
|
||||
if (!success)
|
||||
{
|
||||
// Okay, something's really broken with /tmp
|
||||
[download cancel];
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUTemporaryDirectoryError userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Can't make a temporary directory for the update download at %@.",tempDir] forKey:NSLocalizedDescriptionKey]]];
|
||||
if (!success)
|
||||
{
|
||||
// Okay, something's really broken with /tmp
|
||||
[download cancel];
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUTemporaryDirectoryError userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Can't make a temporary directory for the update download at %@.",tempDir] forKey:NSLocalizedDescriptionKey]]];
|
||||
}
|
||||
|
||||
downloadPath = [[tempDir stringByAppendingPathComponent:name] retain];
|
||||
[download setDestination:downloadPath allowOverwrite:YES];
|
||||
}
|
||||
|
||||
downloadPath = [[tempDir stringByAppendingPathComponent:name] retain];
|
||||
[download setDestination:downloadPath allowOverwrite:YES];
|
||||
}
|
||||
|
||||
- (void)downloadDidFinish:(NSURLDownload *)d
|
||||
@@ -226,8 +230,9 @@
|
||||
{
|
||||
if ([[updater delegate] respondsToSelector:@selector(updater:willInstallUpdate:)])
|
||||
[[updater delegate] updater:updater willInstallUpdate:updateItem];
|
||||
|
||||
// Copy the relauncher into a temporary directory so we can get to it after the new version's installed.
|
||||
NSString *relaunchPathToCopy = [[NSBundle bundleForClass:[self class]] pathForResource:@"relaunch" ofType:@""];
|
||||
NSString *relaunchPathToCopy = [[NSBundle bundleForClass:[self class]] pathForResource:@"relaunch" ofType:@""];
|
||||
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;
|
||||
@@ -235,7 +240,7 @@
|
||||
[[NSFileManager defaultManager] removeFileAtPath:targetPath handler:nil];
|
||||
if ([[NSFileManager defaultManager] copyPath:relaunchPathToCopy toPath:targetPath handler:nil])
|
||||
#else
|
||||
[[NSFileManager defaultManager] removeItemAtPath:targetPath error:NULL];
|
||||
[[NSFileManager defaultManager] removeItemAtPath:targetPath error:nil];
|
||||
if ([[NSFileManager defaultManager] copyItemAtPath:relaunchPathToCopy toPath:targetPath error:&error])
|
||||
#endif
|
||||
relaunchPath = [targetPath retain];
|
||||
@@ -292,7 +297,7 @@
|
||||
#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];
|
||||
[[NSFileManager defaultManager] removeItemAtPath:[downloadPath stringByDeletingLastPathComponent] error:nil];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+18
-18
@@ -11,26 +11,26 @@
|
||||
#define SUCONSTANTS_H
|
||||
|
||||
|
||||
extern NSString *SUUpdaterWillRestartNotification;
|
||||
extern NSString *SUTechnicalErrorInformationKey;
|
||||
extern NSString *const SUUpdaterWillRestartNotification;
|
||||
extern NSString *const SUTechnicalErrorInformationKey;
|
||||
|
||||
extern NSString *SUFeedURLKey;
|
||||
extern NSString *SUHasLaunchedBeforeKey;
|
||||
extern NSString *SUShowReleaseNotesKey;
|
||||
extern NSString *SUSkippedVersionKey;
|
||||
extern NSString *SUScheduledCheckIntervalKey;
|
||||
extern NSString *SULastCheckTimeKey;
|
||||
extern NSString *SUPublicDSAKeyKey;
|
||||
extern NSString *SUPublicDSAKeyFileKey;
|
||||
extern NSString *SUAutomaticallyUpdateKey;
|
||||
extern NSString *SUAllowsAutomaticUpdatesKey;
|
||||
extern NSString *SUEnableAutomaticChecksKey;
|
||||
extern NSString *SUEnableAutomaticChecksKeyOld;
|
||||
extern NSString *SUEnableSystemProfilingKey;
|
||||
extern NSString *SUSendProfileInfoKey;
|
||||
extern NSString *SULastProfileSubmitDateKey;
|
||||
extern NSString *const SUFeedURLKey;
|
||||
extern NSString *const SUHasLaunchedBeforeKey;
|
||||
extern NSString *const SUShowReleaseNotesKey;
|
||||
extern NSString *const SUSkippedVersionKey;
|
||||
extern NSString *const SUScheduledCheckIntervalKey;
|
||||
extern NSString *const SULastCheckTimeKey;
|
||||
extern NSString *const SUPublicDSAKeyKey;
|
||||
extern NSString *const SUPublicDSAKeyFileKey;
|
||||
extern NSString *const SUAutomaticallyUpdateKey;
|
||||
extern NSString *const SUAllowsAutomaticUpdatesKey;
|
||||
extern NSString *const SUEnableAutomaticChecksKey;
|
||||
extern NSString *const SUEnableAutomaticChecksKeyOld;
|
||||
extern NSString *const SUEnableSystemProfilingKey;
|
||||
extern NSString *const SUSendProfileInfoKey;
|
||||
extern NSString *const SULastProfileSubmitDateKey;
|
||||
|
||||
extern NSString *SUSparkleErrorDomain;
|
||||
extern NSString *const SUSparkleErrorDomain;
|
||||
// Appcast phase errors.
|
||||
extern OSStatus SUAppcastParseError;
|
||||
extern OSStatus SUNoUpdateError;
|
||||
|
||||
+19
-19
@@ -9,27 +9,27 @@
|
||||
#import "Sparkle.h"
|
||||
#import "SUConstants.h"
|
||||
|
||||
NSString *SUUpdaterWillRestartNotification = @"SUUpdaterWillRestartNotificationName";
|
||||
NSString *SUTechnicalErrorInformationKey = @"SUTechnicalErrorInformation";
|
||||
NSString *const SUUpdaterWillRestartNotification = @"SUUpdaterWillRestartNotificationName";
|
||||
NSString *const SUTechnicalErrorInformationKey = @"SUTechnicalErrorInformation";
|
||||
|
||||
NSString *SUHasLaunchedBeforeKey = @"SUHasLaunchedBefore";
|
||||
NSString *SUFeedURLKey = @"SUFeedURL";
|
||||
NSString *SUShowReleaseNotesKey = @"SUShowReleaseNotes";
|
||||
NSString *SUSkippedVersionKey = @"SUSkippedVersion";
|
||||
NSString *SUScheduledCheckIntervalKey = @"SUScheduledCheckInterval";
|
||||
NSString *SULastCheckTimeKey = @"SULastCheckTime";
|
||||
NSString *SUExpectsDSASignatureKey = @"SUExpectsDSASignature";
|
||||
NSString *SUPublicDSAKeyKey = @"SUPublicDSAKey";
|
||||
NSString *SUPublicDSAKeyFileKey = @"SUPublicDSAKeyFile";
|
||||
NSString *SUAutomaticallyUpdateKey = @"SUAutomaticallyUpdate";
|
||||
NSString *SUAllowsAutomaticUpdatesKey = @"SUAllowsAutomaticUpdates";
|
||||
NSString *SUEnableSystemProfilingKey = @"SUEnableSystemProfiling";
|
||||
NSString *SUEnableAutomaticChecksKey = @"SUEnableAutomaticChecks";
|
||||
NSString *SUEnableAutomaticChecksKeyOld = @"SUCheckAtStartup";
|
||||
NSString *SUSendProfileInfoKey = @"SUSendProfileInfo";
|
||||
NSString *SULastProfileSubmitDateKey = @"SULastProfileSubmissionDate";
|
||||
NSString *const SUHasLaunchedBeforeKey = @"SUHasLaunchedBefore";
|
||||
NSString *const SUFeedURLKey = @"SUFeedURL";
|
||||
NSString *const SUShowReleaseNotesKey = @"SUShowReleaseNotes";
|
||||
NSString *const SUSkippedVersionKey = @"SUSkippedVersion";
|
||||
NSString *const SUScheduledCheckIntervalKey = @"SUScheduledCheckInterval";
|
||||
NSString *const SULastCheckTimeKey = @"SULastCheckTime";
|
||||
NSString *const SUExpectsDSASignatureKey = @"SUExpectsDSASignature";
|
||||
NSString *const SUPublicDSAKeyKey = @"SUPublicDSAKey";
|
||||
NSString *const SUPublicDSAKeyFileKey = @"SUPublicDSAKeyFile";
|
||||
NSString *const SUAutomaticallyUpdateKey = @"SUAutomaticallyUpdate";
|
||||
NSString *const SUAllowsAutomaticUpdatesKey = @"SUAllowsAutomaticUpdates";
|
||||
NSString *const SUEnableSystemProfilingKey = @"SUEnableSystemProfiling";
|
||||
NSString *const SUEnableAutomaticChecksKey = @"SUEnableAutomaticChecks";
|
||||
NSString *const SUEnableAutomaticChecksKeyOld = @"SUCheckAtStartup";
|
||||
NSString *const SUSendProfileInfoKey = @"SUSendProfileInfo";
|
||||
NSString *const SULastProfileSubmitDateKey = @"SULastProfileSubmissionDate";
|
||||
|
||||
NSString *SUSparkleErrorDomain = @"SUSparkleErrorDomain";
|
||||
NSString *const SUSparkleErrorDomain = @"SUSparkleErrorDomain";
|
||||
OSStatus SUAppcastParseError = 1000;
|
||||
OSStatus SUNoUpdateError = 1001;
|
||||
OSStatus SUAppcastError = 1002;
|
||||
|
||||
+30
-16
@@ -17,7 +17,7 @@
|
||||
#import <openssl/rsa.h>
|
||||
#import <openssl/sha.h>
|
||||
|
||||
long b64decode(unsigned char* str)
|
||||
static long b64decode(unsigned char* str)
|
||||
{
|
||||
unsigned char *cur, *start;
|
||||
int d, dlast, phase;
|
||||
@@ -41,12 +41,12 @@ long b64decode(unsigned char* str)
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 /* F0-FF */
|
||||
};
|
||||
|
||||
d = dlast = phase = 0;
|
||||
dlast = phase = 0;
|
||||
start = str;
|
||||
for (cur = str; *cur != '\0'; ++cur )
|
||||
{
|
||||
if(*cur == '\n' || *cur == '\r'){phase = dlast = 0; continue;}
|
||||
d = table[(int)*cur];
|
||||
d = table[(unsigned int)*cur];
|
||||
if(d != -1)
|
||||
{
|
||||
switch(phase)
|
||||
@@ -77,26 +77,30 @@ long b64decode(unsigned char* str)
|
||||
return str - start;
|
||||
}
|
||||
|
||||
EVP_PKEY* load_dsa_key(char *key)
|
||||
static EVP_PKEY* load_dsa_key(char *key)
|
||||
{
|
||||
EVP_PKEY* pkey = NULL;
|
||||
BIO *bio;
|
||||
if((bio = BIO_new_mem_buf(key, (int)strlen(key))))
|
||||
size_t keylen = strlen(key);
|
||||
if (keylen <= INT_MAX)
|
||||
{
|
||||
DSA* dsa_key = 0;
|
||||
if(PEM_read_bio_DSA_PUBKEY(bio, &dsa_key, NULL, NULL))
|
||||
BIO *bio;
|
||||
if((bio = BIO_new_mem_buf(key, (int)keylen)))
|
||||
{
|
||||
if((pkey = EVP_PKEY_new()))
|
||||
DSA* dsa_key = 0;
|
||||
if(PEM_read_bio_DSA_PUBKEY(bio, &dsa_key, NULL, NULL))
|
||||
{
|
||||
if(EVP_PKEY_assign_DSA(pkey, dsa_key) != 1)
|
||||
if((pkey = EVP_PKEY_new()))
|
||||
{
|
||||
DSA_free(dsa_key);
|
||||
EVP_PKEY_free(pkey);
|
||||
pkey = NULL;
|
||||
if(EVP_PKEY_assign_DSA(pkey, dsa_key) != 1)
|
||||
{
|
||||
DSA_free(dsa_key);
|
||||
EVP_PKEY_free(pkey);
|
||||
pkey = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIO_free(bio);
|
||||
}
|
||||
BIO_free(bio);
|
||||
}
|
||||
return pkey;
|
||||
}
|
||||
@@ -119,12 +123,15 @@ EVP_PKEY* load_dsa_key(char *key)
|
||||
}
|
||||
pkeyString = [pkeyTrimmedLines componentsJoinedByString:@"\n"]; // Put them back together.
|
||||
|
||||
NSMutableData* pkeyData = [[[pkeyString dataUsingEncoding:NSUTF8StringEncoding] mutableCopy] autorelease];
|
||||
void *pkeyBytes = [pkeyData mutableBytes];
|
||||
EVP_PKEY* pkey = NULL;
|
||||
pkey = load_dsa_key((char *)[pkeyString UTF8String]);
|
||||
pkey = load_dsa_key(pkeyBytes);
|
||||
if (!pkey) { return NO; }
|
||||
|
||||
// Now, the signature is in base64; we have to decode it into a binary stream.
|
||||
unsigned char *signature = (unsigned char *)[encodedSignature UTF8String];
|
||||
NSMutableData* signatureData = [[[encodedSignature dataUsingEncoding:NSUTF8StringEncoding] mutableCopy] autorelease];
|
||||
void *signature = [signatureData mutableBytes];
|
||||
long length = b64decode(signature); // Decode the signature in-place and get the new length of the signature string.
|
||||
|
||||
// We've got the signature, now get the file data.
|
||||
@@ -140,10 +147,17 @@ EVP_PKEY* load_dsa_key(char *key)
|
||||
if(EVP_VerifyInit(&ctx, EVP_dss1()) == 1) // We're using DSA keys.
|
||||
{
|
||||
EVP_VerifyUpdate(&ctx, md, SHA_DIGEST_LENGTH);
|
||||
if ((length < 0) || (length > 0x7FFFFFFF)) { return NO; } // test before cast below
|
||||
result = (EVP_VerifyFinal(&ctx, signature, (unsigned int)length, pkey) == 1);
|
||||
}
|
||||
|
||||
EVP_PKEY_free(pkey);
|
||||
|
||||
// Prevent these from being collected earlier than we want (our only reference is an inner pointer).
|
||||
[pkeyData self];
|
||||
[signatureData self];
|
||||
[pathData self];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,14 +35,13 @@
|
||||
do
|
||||
{
|
||||
CFUUIDRef uuid = CFUUIDCreate(NULL);
|
||||
mountPointName = (NSString *)CFUUIDCreateString(NULL, uuid);
|
||||
CFRelease(uuid);
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
|
||||
[NSMakeCollectable((CFStringRef)mountPointName) autorelease];
|
||||
#else
|
||||
[mountPointName autorelease];
|
||||
#endif
|
||||
mountPoint = [@"/Volumes" stringByAppendingPathComponent:mountPointName];
|
||||
if (uuid)
|
||||
{
|
||||
CFStringRef uuidString = CFUUIDCreateString(NULL, uuid);
|
||||
CFRelease(uuid);
|
||||
mountPoint = [@"/Volumes" stringByAppendingPathComponent:(NSString*)uuidString];
|
||||
CFRelease(uuidString);
|
||||
}
|
||||
}
|
||||
while (noErr == FSPathMakeRefWithOptions((UInt8 *)[mountPoint fileSystemRepresentation], kFSPathMakeRefDoNotFollowLeafSymlink, &tmpRef, NULL));
|
||||
|
||||
@@ -57,7 +56,7 @@
|
||||
|
||||
// Now that we've mounted it, we need to copy out its contents.
|
||||
FSRef srcRef, dstRef;
|
||||
OSErr err;
|
||||
OSStatus err;
|
||||
err = FSPathMakeRef((UInt8 *)[mountPoint fileSystemRepresentation], &srcRef, NULL);
|
||||
if (err != noErr) goto reportError;
|
||||
err = FSPathMakeRef((UInt8 *)[[archivePath stringByDeletingLastPathComponent] fileSystemRepresentation], &dstRef, NULL);
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
|
||||
- (id)initWithBundle:(NSBundle *)aBundle
|
||||
{
|
||||
if (aBundle == nil) aBundle = [NSBundle mainBundle];
|
||||
if ((self = [super init]))
|
||||
{
|
||||
if (aBundle == nil) aBundle = [NSBundle mainBundle];
|
||||
bundle = [aBundle retain];
|
||||
if (![bundle bundleIdentifier])
|
||||
NSLog(@"Sparkle Error: the bundle being updated at %@ has no CFBundleIdentifier! This will cause preference read/write to not work properly.", bundle);
|
||||
@@ -114,7 +114,7 @@
|
||||
// More likely, we've got a reference to a Resources file by filename:
|
||||
NSString *keyFilename = [self objectForInfoDictionaryKey:SUPublicDSAKeyFileKey];
|
||||
if (!keyFilename) { return nil; }
|
||||
NSError *ignoreErr;
|
||||
NSError *ignoreErr = nil;
|
||||
return [NSString stringWithContentsOfFile:[bundle pathForResource:keyFilename ofType:nil] encoding:NSASCIIStringEncoding error: &ignoreErr];
|
||||
}
|
||||
|
||||
@@ -135,18 +135,14 @@
|
||||
|
||||
- (id)objectForUserDefaultsKey:(NSString *)defaultName
|
||||
{
|
||||
// Under Tiger, CFPreferencesCopyAppValue doesn't get values from NSRegistratioDomain, so anything
|
||||
// Under Tiger, CFPreferencesCopyAppValue doesn't get values from NSRegistrationDomain, so anything
|
||||
// passed into -[NSUserDefaults registerDefaults:] is ignored. The following line falls
|
||||
// back to using NSUserDefaults, but only if the host bundle is the main bundle.
|
||||
if (bundle == [NSBundle mainBundle])
|
||||
return [[NSUserDefaults standardUserDefaults] objectForKey:defaultName];
|
||||
|
||||
CFPropertyListRef obj = CFPreferencesCopyAppValue((CFStringRef)defaultName, (CFStringRef)[bundle bundleIdentifier]);
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
|
||||
return [NSMakeCollectable(obj) autorelease];
|
||||
#else
|
||||
return [(id)obj autorelease];
|
||||
#endif
|
||||
return [(id)CFMakeCollectable(obj) autorelease];
|
||||
}
|
||||
|
||||
- (void)setObject:(id)value forUserDefaultsKey:(NSString *)defaultName;
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@
|
||||
|
||||
+ (void)_finishInstallationWithResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate
|
||||
{
|
||||
if (result == YES)
|
||||
if (result)
|
||||
{
|
||||
[self _mdimportHost:host];
|
||||
if ([delegate respondsToSelector:@selector(installerFinishedForHost:)])
|
||||
|
||||
+5
-5
@@ -49,9 +49,9 @@
|
||||
|
||||
// Get the file size.
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
NSNumber *fs = [[[NSFileManager defaultManager] fileAttributesAtPath:archivePath traverseLink:NO] objectForKey:NSFileSize];
|
||||
NSNumber *fs = [[[NSFileManager defaultManager] fileAttributesAtPath:archivePath traverseLink:NO] objectForKey:NSFileSize];
|
||||
#else
|
||||
NSNumber *fs = [[[NSFileManager defaultManager] attributesOfItemAtPath:archivePath error:NULL] objectForKey:NSFileSize];
|
||||
NSNumber *fs = [[[NSFileManager defaultManager] attributesOfItemAtPath:archivePath error:nil] objectForKey:NSFileSize];
|
||||
#endif
|
||||
if (fs == nil) goto reportError;
|
||||
|
||||
@@ -62,11 +62,11 @@
|
||||
|
||||
setenv("DESTINATION", [[archivePath stringByDeletingLastPathComponent] fileSystemRepresentation], 1);
|
||||
cmdFP = popen([command fileSystemRepresentation], "w");
|
||||
long written;
|
||||
size_t written;
|
||||
if (!cmdFP) goto reportError;
|
||||
|
||||
char buf[32*1024];
|
||||
long len;
|
||||
size_t len;
|
||||
while((len = fread(buf, 1, 32*1024, fp)))
|
||||
{
|
||||
written = fwrite(buf, 1, len, cmdFP);
|
||||
@@ -76,7 +76,7 @@
|
||||
goto reportError;
|
||||
}
|
||||
|
||||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfExtractedLength:) withObject:[NSNumber numberWithLong:len] waitUntilDone:NO];
|
||||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfExtractedLength:) withObject:[NSNumber numberWithUnsignedLong:len] waitUntilDone:NO];
|
||||
}
|
||||
pclose(cmdFP);
|
||||
|
||||
|
||||
+7
-7
@@ -9,13 +9,13 @@
|
||||
#import "SUPlainInstaller.h"
|
||||
#import "SUPlainInstallerInternals.h"
|
||||
|
||||
NSString *SUInstallerPathKey = @"SUInstallerPath";
|
||||
NSString *SUInstallerTargetPathKey = @"SUInstallerTargetPath";
|
||||
NSString *SUInstallerTempNameKey = @"SUInstallerTempName";
|
||||
NSString *SUInstallerHostKey = @"SUInstallerHost";
|
||||
NSString *SUInstallerDelegateKey = @"SUInstallerDelegate";
|
||||
NSString *SUInstallerResultKey = @"SUInstallerResult";
|
||||
NSString *SUInstallerErrorKey = @"SUInstallerError";
|
||||
static NSString * const SUInstallerPathKey = @"SUInstallerPath";
|
||||
static NSString * const SUInstallerTargetPathKey = @"SUInstallerTargetPath";
|
||||
static NSString * const SUInstallerTempNameKey = @"SUInstallerTempName";
|
||||
static NSString * const SUInstallerHostKey = @"SUInstallerHost";
|
||||
static NSString * const SUInstallerDelegateKey = @"SUInstallerDelegate";
|
||||
static NSString * const SUInstallerResultKey = @"SUInstallerResult";
|
||||
static NSString * const SUInstallerErrorKey = @"SUInstallerError";
|
||||
|
||||
@implementation SUPlainInstaller
|
||||
|
||||
|
||||
+17
-14
@@ -79,9 +79,9 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
NSString *prefix = [[path stringByDeletingPathExtension] stringByAppendingFormat:@" (%@)", postFix];
|
||||
NSString *tempDir = [prefix stringByAppendingPathExtension:[path pathExtension]];
|
||||
// Now let's make sure we get a unique path.
|
||||
int cnt=2;
|
||||
unsigned int cnt=2;
|
||||
while ([[NSFileManager defaultManager] fileExistsAtPath:tempDir] && cnt <= 999)
|
||||
tempDir = [NSString stringWithFormat:@"%@ %d.%@", prefix, cnt++, [path pathExtension]];
|
||||
tempDir = [NSString stringWithFormat:@"%@ %u.%@", prefix, cnt++, [path pathExtension]];
|
||||
return [tempDir lastPathComponent];
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
};
|
||||
|
||||
// Process the commands up until the first NULL
|
||||
int commandIndex = 0;
|
||||
unsigned int commandIndex = 0;
|
||||
for (; executables[commandIndex] != NULL; ++commandIndex) {
|
||||
if (res)
|
||||
res = AuthorizationExecuteWithPrivilegesAndWait(auth, executables[commandIndex], kAuthorizationFlagDefaults, argumentLists[commandIndex]);
|
||||
@@ -173,13 +173,13 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
{
|
||||
// Something went wrong somewhere along the way, but we're not sure exactly where.
|
||||
NSString *errorMessage = [NSString stringWithFormat:@"Authenticated file copy from %@ to %@ failed.", src, dst];
|
||||
if (error != NULL)
|
||||
if (error != nil)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:[NSDictionary dictionaryWithObject:errorMessage forKey:NSLocalizedDescriptionKey]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (error != NULL)
|
||||
if (error != nil)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:[NSDictionary dictionaryWithObject:@"Couldn't get permission to authenticate." forKey:NSLocalizedDescriptionKey]];
|
||||
}
|
||||
return res;
|
||||
@@ -195,13 +195,13 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
+ (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst temporaryName:(NSString *)tmp error:(NSError **)error
|
||||
{
|
||||
FSRef srcRef, dstRef, targetRef, movedRef;
|
||||
OSErr err;
|
||||
OSStatus err;
|
||||
|
||||
err = FSPathMakeRefWithOptions((UInt8 *)[dst fileSystemRepresentation], kFSPathMakeRefDoNotFollowLeafSymlink, &dstRef, NULL);
|
||||
if (err != noErr)
|
||||
{
|
||||
NSString *errorMessage = [NSString stringWithFormat:@"Couldn't copy %@ over %@ because there is no file at %@.", src, dst, dst];
|
||||
if (error != NULL)
|
||||
if (error != nil)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:errorMessage forKey:NSLocalizedDescriptionKey]];
|
||||
return NO;
|
||||
}
|
||||
@@ -216,7 +216,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
err = FSMoveObjectSync(&dstRef, &targetRef, (CFStringRef)tmp, &movedRef, 0);
|
||||
if (err != noErr)
|
||||
{
|
||||
if (error != NULL)
|
||||
if (error != nil)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath] forKey:NSLocalizedDescriptionKey]];
|
||||
return NO;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
{
|
||||
// We better move the old version back to its old location
|
||||
FSMoveObjectSync(&movedRef, &targetRef, (CFStringRef)[dst lastPathComponent], &movedRef, 0);
|
||||
if (error != NULL)
|
||||
if (error != nil)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't copy %@ to %@.", src, dst] forKey:NSLocalizedDescriptionKey]];
|
||||
return NO;
|
||||
}
|
||||
@@ -258,9 +258,9 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
|
||||
@end
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <sys/xattr.h>
|
||||
#import <dlfcn.h>
|
||||
#import <errno.h>
|
||||
#import <sys/xattr.h>
|
||||
|
||||
@implementation SUPlainInstaller (MMExtendedAttributes)
|
||||
|
||||
@@ -308,8 +308,11 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
|
||||
// Only recurse if it's actually a directory. Don't recurse into a
|
||||
// root-level symbolic link.
|
||||
NSDictionary* rootAttributes =
|
||||
[[NSFileManager defaultManager] fileAttributesAtPath:root traverseLink:NO];
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
NSDictionary* rootAttributes = [[NSFileManager defaultManager] fileAttributesAtPath:root traverseLink:NO];
|
||||
#else
|
||||
NSDictionary* rootAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:root error:nil];
|
||||
#endif
|
||||
NSString* rootType = [rootAttributes objectForKey:NSFileType];
|
||||
|
||||
if (rootType == NSFileTypeDirectory) {
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUUIBasedUpdateDriver.h"
|
||||
|
||||
@interface SUScheduledUpdateDriver : SUUIBasedUpdateDriver {
|
||||
@interface SUScheduledUpdateDriver : SUUIBasedUpdateDriver
|
||||
{
|
||||
@private
|
||||
BOOL showErrors;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@ typedef enum {
|
||||
{
|
||||
NSString *character;
|
||||
NSMutableString *s;
|
||||
NSInteger i, n, oldType, newType;
|
||||
NSUInteger i, n;
|
||||
SUCharacterType oldType, newType;
|
||||
NSMutableArray *parts = [NSMutableArray array];
|
||||
if ([version length] == 0) {
|
||||
// Nothing to do here
|
||||
@@ -76,8 +77,10 @@ typedef enum {
|
||||
NSArray *partsB = [self splitVersionString:versionB];
|
||||
|
||||
NSString *partA, *partB;
|
||||
NSInteger i, n, typeA, typeB, intA, intB;
|
||||
|
||||
NSUInteger i, n;
|
||||
int intA, intB;
|
||||
SUCharacterType typeA, typeB;
|
||||
|
||||
n = MIN([partsA count], [partsB count]);
|
||||
for (i = 0; i < n; ++i) {
|
||||
partA = [partsA objectAtIndex:i];
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
#import "SUWindowController.h"
|
||||
|
||||
@class SUHost;
|
||||
@interface SUStatusController : SUWindowController {
|
||||
@interface SUStatusController : SUWindowController
|
||||
{
|
||||
@private
|
||||
double progressValue, maxProgressValue;
|
||||
NSString *title, *statusText, *buttonTitle;
|
||||
IBOutlet NSButton *actionButton;
|
||||
|
||||
@@ -111,10 +111,10 @@
|
||||
|
||||
- (void)setMaxProgressValue:(double)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value < 0.0) value = 0.0;
|
||||
maxProgressValue = value;
|
||||
[self setProgressValue:0];
|
||||
[progressBar setIndeterminate:(value == 0)];
|
||||
[self setProgressValue:0.0];
|
||||
[progressBar setIndeterminate:(value == 0.0)];
|
||||
[progressBar startAnimation:self];
|
||||
}
|
||||
|
||||
|
||||
+16
-17
@@ -34,9 +34,9 @@
|
||||
// Gather profile information and append it to the URL.
|
||||
NSMutableArray *profileArray = [NSMutableArray array];
|
||||
NSArray *profileDictKeys = [NSArray arrayWithObjects:@"key", @"displayKey", @"value", @"displayValue", nil];
|
||||
int error = 0 ;
|
||||
int value = 0 ;
|
||||
unsigned long length = sizeof(value) ;
|
||||
int error = 0;
|
||||
int value = 0;
|
||||
size_t length = sizeof(value);
|
||||
|
||||
// OS version
|
||||
NSString *currentSystemVersion = [SUHost systemVersionString];
|
||||
@@ -89,18 +89,18 @@
|
||||
}
|
||||
error = sysctlbyname("hw.model", NULL, &length, NULL, 0);
|
||||
if (error == 0) {
|
||||
char *cpuModel;
|
||||
cpuModel = (char *)malloc(sizeof(char) * length);
|
||||
error = sysctlbyname("hw.model", cpuModel, &length, NULL, 0);
|
||||
if (error == 0) {
|
||||
NSString *rawModelName = [NSString stringWithUTF8String:cpuModel];
|
||||
NSString *visibleModelName = [modelTranslation objectForKey:rawModelName];
|
||||
if (visibleModelName == nil)
|
||||
visibleModelName = rawModelName;
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"model",@"Mac Model", rawModelName, visibleModelName, nil] forKeys:profileDictKeys]];
|
||||
}
|
||||
if (cpuModel != NULL)
|
||||
char *cpuModel = (char *)malloc(sizeof(char) * length);
|
||||
if (cpuModel != NULL) {
|
||||
error = sysctlbyname("hw.model", cpuModel, &length, NULL, 0);
|
||||
if (error == 0) {
|
||||
NSString *rawModelName = [NSString stringWithUTF8String:cpuModel];
|
||||
NSString *visibleModelName = [modelTranslation objectForKey:rawModelName];
|
||||
if (visibleModelName == nil)
|
||||
visibleModelName = rawModelName;
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"model",@"Mac Model", rawModelName, visibleModelName, nil] forKeys:profileDictKeys]];
|
||||
}
|
||||
free(cpuModel);
|
||||
}
|
||||
}
|
||||
|
||||
// Number of CPUs
|
||||
@@ -111,7 +111,7 @@
|
||||
// User preferred language
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
NSArray *languages = [defs objectForKey:@"AppleLanguages"];
|
||||
if (languages && ([languages count] > 0))
|
||||
if ([languages count] > 0)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"lang",@"Preferred Language", [languages objectAtIndex:0], [languages objectAtIndex:0],nil] forKeys:profileDictKeys]];
|
||||
|
||||
// Application sending the request
|
||||
@@ -124,9 +124,8 @@
|
||||
|
||||
// Number of displays?
|
||||
// CPU speed
|
||||
OSErr err;
|
||||
SInt32 gestaltInfo;
|
||||
err = Gestalt(gestaltProcClkSpeedMHz,&gestaltInfo);
|
||||
OSErr err = Gestalt(gestaltProcClkSpeedMHz,&gestaltInfo);
|
||||
if (err == noErr)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"cpuFreqMHz",@"CPU Speed (GHz)", [NSNumber numberWithInt:gestaltInfo], [NSNumber numberWithDouble:gestaltInfo/1000.0],nil] forKeys:profileDictKeys]];
|
||||
|
||||
|
||||
+22
-18
@@ -61,7 +61,7 @@
|
||||
{
|
||||
case SUInstallUpdateChoice:
|
||||
statusController = [[SUStatusController alloc] initWithHost:host];
|
||||
[statusController beginActionWithTitle:SULocalizedString(@"Downloading update...", @"Take care not to overflow the status window.") maxProgressValue:0 statusText:nil];
|
||||
[statusController beginActionWithTitle:SULocalizedString(@"Downloading update...", @"Take care not to overflow the status window.") maxProgressValue:0.0 statusText:nil];
|
||||
[statusController setButtonTitle:SULocalizedString(@"Cancel", nil) target:self action:@selector(cancelDownload:) isDefault:NO];
|
||||
[statusController showWindow:self];
|
||||
[self downloadUpdate];
|
||||
@@ -82,22 +82,22 @@
|
||||
|
||||
- (NSString *)_humanReadableSizeFromDouble:(double)value
|
||||
{
|
||||
if (value < 1024)
|
||||
if (value < 1000)
|
||||
return [NSString stringWithFormat:@"%.0lf %@", value, SULocalizedString(@"B", @"the unit for bytes")];
|
||||
|
||||
if (value < 1024 * 1024)
|
||||
return [NSString stringWithFormat:@"%.0lf %@", value / 1024.0, SULocalizedString(@"KB", @"the unit for kilobytes")];
|
||||
if (value < 1000 * 1000)
|
||||
return [NSString stringWithFormat:@"%.0lf %@", value / 1000.0, SULocalizedString(@"KB", @"the unit for kilobytes")];
|
||||
|
||||
if (value < 1024 * 1024 * 1024)
|
||||
return [NSString stringWithFormat:@"%.1lf %@", value / 1024.0 / 1024.0, SULocalizedString(@"MB", @"the unit for megabytes")];
|
||||
if (value < 1000 * 1000 * 1000)
|
||||
return [NSString stringWithFormat:@"%.1lf %@", value / 1000.0 / 1000.0, SULocalizedString(@"MB", @"the unit for megabytes")];
|
||||
|
||||
return [NSString stringWithFormat:@"%.2lf %@", value / 1024.0 / 1024.0 / 1024.0, SULocalizedString(@"GB", @"the unit for gigabytes")];
|
||||
return [NSString stringWithFormat:@"%.2lf %@", value / 1000.0 / 1000.0 / 1000.0, SULocalizedString(@"GB", @"the unit for gigabytes")];
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)download didReceiveDataOfLength:(NSUInteger)length
|
||||
{
|
||||
[statusController setProgressValue:[statusController progressValue] + length];
|
||||
if ([statusController maxProgressValue] > 0)
|
||||
[statusController setProgressValue:[statusController progressValue] + (double)length];
|
||||
if ([statusController maxProgressValue] > 0.0)
|
||||
[statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ of %@", nil), [self _humanReadableSizeFromDouble:[statusController progressValue]], [self _humanReadableSizeFromDouble:[statusController maxProgressValue]]]];
|
||||
else
|
||||
[statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ downloaded", nil), [self _humanReadableSizeFromDouble:[statusController progressValue]]]];
|
||||
@@ -113,27 +113,31 @@
|
||||
- (void)extractUpdate
|
||||
{
|
||||
// Now we have to extract the downloaded archive.
|
||||
[statusController beginActionWithTitle:SULocalizedString(@"Extracting update...", @"Take care not to overflow the status window.") maxProgressValue:0 statusText:nil];
|
||||
[statusController beginActionWithTitle:SULocalizedString(@"Extracting update...", @"Take care not to overflow the status window.") maxProgressValue:0.0 statusText:nil];
|
||||
[statusController setButtonEnabled:NO];
|
||||
[super extractUpdate];
|
||||
}
|
||||
|
||||
- (void)unarchiver:(SUUnarchiver *)ua extractedLength:(long)length
|
||||
- (void)unarchiver:(SUUnarchiver *)ua extractedLength:(unsigned 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 ([statusController maxProgressValue] == 0.0)
|
||||
{
|
||||
NSDictionary * attributes;
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
[statusController setMaxProgressValue:[[[[NSFileManager defaultManager] fileAttributesAtPath:downloadPath traverseLink:NO] objectForKey:NSFileSize] doubleValue]];
|
||||
attributes = [[NSFileManager defaultManager] fileAttributesAtPath:downloadPath traverseLink:NO];
|
||||
#else
|
||||
[statusController setMaxProgressValue:[[[[NSFileManager defaultManager] attributesOfItemAtPath:downloadPath error:NULL] objectForKey:NSFileSize] doubleValue]];
|
||||
attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:downloadPath error:nil];
|
||||
#endif
|
||||
[statusController setProgressValue:[statusController progressValue] + length];
|
||||
[statusController setMaxProgressValue:[[attributes objectForKey:NSFileSize] doubleValue]];
|
||||
}
|
||||
[statusController setProgressValue:[statusController progressValue] + (double)length];
|
||||
}
|
||||
|
||||
- (void)unarchiverDidFinish:(SUUnarchiver *)ua
|
||||
{
|
||||
[statusController beginActionWithTitle:SULocalizedString(@"Ready to Install", nil) maxProgressValue:1 statusText:nil];
|
||||
[statusController setProgressValue:1]; // Fill the bar.
|
||||
[statusController beginActionWithTitle:SULocalizedString(@"Ready to Install", nil) maxProgressValue:1.0 statusText:nil];
|
||||
[statusController setProgressValue:1.0]; // Fill the bar.
|
||||
[statusController setButtonEnabled:YES];
|
||||
[statusController setButtonTitle:SULocalizedString(@"Install and Relaunch", nil) target:self action:@selector(installAndRestart:) isDefault:YES];
|
||||
[NSApp requestUserAttention:NSInformationalRequest];
|
||||
@@ -143,7 +147,7 @@
|
||||
|
||||
- (void)installUpdate
|
||||
{
|
||||
[statusController beginActionWithTitle:SULocalizedString(@"Installing update...", @"Take care not to overflow the status window.") maxProgressValue:0 statusText:nil];
|
||||
[statusController beginActionWithTitle:SULocalizedString(@"Installing update...", @"Take care not to overflow the status window.") maxProgressValue:0.0 statusText:nil];
|
||||
[statusController setButtonEnabled:NO];
|
||||
[super installUpdate];
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
@end
|
||||
|
||||
@interface NSObject (SUUnarchiverDelegate)
|
||||
- (void)unarchiver:(SUUnarchiver *)unarchiver extractedLength:(long)length;
|
||||
- (void)unarchiver:(SUUnarchiver *)unarchiver extractedLength:(unsigned long)length;
|
||||
- (void)unarchiverDidFinish:(SUUnarchiver *)unarchiver;
|
||||
- (void)unarchiverDidFail:(SUUnarchiver *)unarchiver;
|
||||
@end
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
- (void)_notifyDelegateOfExtractedLength:(NSNumber *)length
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(unarchiver:extractedLength:)])
|
||||
[delegate unarchiver:self extractedLength:[length longValue]];
|
||||
[delegate unarchiver:self extractedLength:[length unsignedLongValue]];
|
||||
}
|
||||
|
||||
- (void)_notifyDelegateOfSuccess
|
||||
|
||||
+1
-1
@@ -182,7 +182,7 @@
|
||||
|
||||
- (void)webView:sender decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:frame decisionListener:listener
|
||||
{
|
||||
if (webViewFinishedLoading == YES) {
|
||||
if (webViewFinishedLoading) {
|
||||
[[NSWorkspace sharedWorkspace] openURL:[request URL]];
|
||||
|
||||
[listener ignore];
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
extern NSString *SUUpdateDriverFinishedNotification;
|
||||
extern NSString * const SUUpdateDriverFinishedNotification;
|
||||
|
||||
@class SUHost, SUUpdater;
|
||||
@interface SUUpdateDriver : NSObject
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
|
||||
#import "SUUpdateDriver.h"
|
||||
|
||||
NSString *SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
|
||||
NSString * const SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
|
||||
|
||||
@implementation SUUpdateDriver
|
||||
- initWithUpdater:(SUUpdater *)anUpdater
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
// the user would not know why the application was paused.
|
||||
if ([aHost isBackgroundApplication]) { [NSApp activateIgnoringOtherApps:YES]; }
|
||||
|
||||
id prompt = [[[self class] alloc] initWithHost:aHost systemProfile:profile delegate:d];
|
||||
id prompt = [[[[self class] alloc] initWithHost:aHost systemProfile:profile delegate:d] autorelease];
|
||||
[NSApp runModalForWindow:[prompt window]];
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -12,7 +12,9 @@
|
||||
#import <Sparkle/SUVersionComparisonProtocol.h>
|
||||
|
||||
@class SUUpdateDriver, SUAppcastItem, SUHost, SUAppcast;
|
||||
@interface SUUpdater : NSObject {
|
||||
@interface SUUpdater : NSObject
|
||||
{
|
||||
@private
|
||||
NSTimer *checkTimer;
|
||||
SUUpdateDriver *driver;
|
||||
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@
|
||||
#pragma mark Initialization
|
||||
|
||||
static NSMutableDictionary *sharedUpdaters = nil;
|
||||
static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObservationContext";
|
||||
static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObservationContext";
|
||||
|
||||
+ (SUUpdater *)sharedUpdater
|
||||
{
|
||||
@@ -351,7 +351,7 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
|
||||
parameters = [parameters arrayByAddingObjectsFromArray:[host systemProfile]];
|
||||
[host setObject:[NSDate date] forUserDefaultsKey:SULastProfileSubmitDateKey];
|
||||
}
|
||||
if (parameters == nil || [parameters count] == 0) { return baseFeedURL; }
|
||||
if ([parameters count] == 0) { return baseFeedURL; }
|
||||
|
||||
// Build up the parameterized URL.
|
||||
NSMutableArray *parameterStrings = [NSMutableArray array];
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUUIBasedUpdateDriver.h"
|
||||
|
||||
@interface SUUserInitiatedUpdateDriver : SUUIBasedUpdateDriver {
|
||||
@interface SUUserInitiatedUpdateDriver : SUUIBasedUpdateDriver
|
||||
{
|
||||
@private
|
||||
SUStatusController *checkingController;
|
||||
BOOL isCanceled;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
{
|
||||
checkingController = [[SUStatusController alloc] initWithHost:aHost];
|
||||
[[checkingController window] center]; // Force the checking controller to load its window.
|
||||
[checkingController beginActionWithTitle:SULocalizedString(@"Checking for updates...", nil) maxProgressValue:0 statusText:nil];
|
||||
[checkingController beginActionWithTitle:SULocalizedString(@"Checking for updates...", nil) maxProgressValue:0.0 statusText:nil];
|
||||
[checkingController setButtonTitle:SULocalizedString(@"Cancel", nil) target:self action:@selector(cancelCheckForUpdates:) isDefault:NO];
|
||||
[checkingController showWindow:self];
|
||||
[super checkForUpdatesAtURL:URL host:aHost];
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
NSBundle *framework = [NSBundle bundleWithPath:frameworkPath];
|
||||
path = [framework pathForResource:nibName ofType:@"nib"];
|
||||
}
|
||||
return [super initWithWindowNibPath:path owner:self];
|
||||
self = [super initWithWindowNibPath:path owner:self];
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -92,6 +92,8 @@
|
||||
DAAEFC9B0DA5722F0051E0D0 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; };
|
||||
DAAEFD4E0DA572330051E0D0 /* relaunch.m in Sources */ = {isa = PBXBuildFile; fileRef = 613242130CD06CEF00106AA4 /* relaunch.m */; };
|
||||
DAAEFD510DA572550051E0D0 /* relaunch in Resources */ = {isa = PBXBuildFile; fileRef = DAAEFC960DA571DF0051E0D0 /* relaunch */; };
|
||||
FA8342D2104A4B1F001FE2FF /* SUStandardVersionComparator.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A225A30D1C4AC000430CCD /* SUStandardVersionComparator.m */; };
|
||||
FA8342DE104A4B54001FE2FF /* SUStandardVersionComparator.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A225A30D1C4AC000430CCD /* SUStandardVersionComparator.m */; };
|
||||
FAEFA2F70D94AA7500472538 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; };
|
||||
FAEFA2F80D94AA7900472538 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; };
|
||||
FAEFA3040D94AB3400472538 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; };
|
||||
@@ -309,6 +311,10 @@
|
||||
FA1941D30D94A70100DD942E /* ConfigRelaunchDebug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigRelaunchDebug.xcconfig; sourceTree = "<group>"; };
|
||||
FA1941D40D94A70100DD942E /* ConfigRelaunchRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigRelaunchRelease.xcconfig; sourceTree = "<group>"; };
|
||||
FA1941D50D94A70100DD942E /* ConfigFrameworkRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigFrameworkRelease.xcconfig; sourceTree = "<group>"; };
|
||||
FA302AFD109D13190060F891 /* ConfigUnitTestReleaseGCSupport.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigUnitTestReleaseGCSupport.xcconfig; sourceTree = "<group>"; };
|
||||
FA3AAF391050B273004B3130 /* ConfigUnitTestRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigUnitTestRelease.xcconfig; sourceTree = "<group>"; };
|
||||
FA3AAF3A1050B273004B3130 /* ConfigUnitTestDebug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigUnitTestDebug.xcconfig; sourceTree = "<group>"; };
|
||||
FA3AAF3B1050B273004B3130 /* ConfigUnitTest.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigUnitTest.xcconfig; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -580,6 +586,10 @@
|
||||
FA1941CE0D94A70100DD942E /* ConfigRelaunch.xcconfig */,
|
||||
FA1941D30D94A70100DD942E /* ConfigRelaunchDebug.xcconfig */,
|
||||
FA1941D40D94A70100DD942E /* ConfigRelaunchRelease.xcconfig */,
|
||||
FA3AAF3B1050B273004B3130 /* ConfigUnitTest.xcconfig */,
|
||||
FA3AAF3A1050B273004B3130 /* ConfigUnitTestDebug.xcconfig */,
|
||||
FA3AAF391050B273004B3130 /* ConfigUnitTestRelease.xcconfig */,
|
||||
FA302AFD109D13190060F891 /* ConfigUnitTestReleaseGCSupport.xcconfig */,
|
||||
);
|
||||
path = Configurations;
|
||||
sourceTree = "<group>";
|
||||
@@ -867,6 +877,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
61227A160DB548B800AB99EA /* SUVersionComparisonTest.m in Sources */,
|
||||
FA8342DE104A4B54001FE2FF /* SUStandardVersionComparator.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -875,6 +886,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
61B5F93009C4CFDC00B25A18 /* main.m in Sources */,
|
||||
FA8342D2104A4B1F001FE2FF /* SUStandardVersionComparator.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -1103,7 +1115,6 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 61072EB20DF2640C008FE88B /* ConfigFrameworkReleaseGCSupport.xcconfig */;
|
||||
buildSettings = {
|
||||
INSTALL_PATH = "@loader_path/../Frameworks";
|
||||
};
|
||||
name = "Release (GC dual-mode; 10.5-only)";
|
||||
};
|
||||
@@ -1123,87 +1134,22 @@
|
||||
};
|
||||
61072EB10DF263BD008FE88B /* Release (GC dual-mode; 10.5-only) */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = FA302AFD109D13190060F891 /* ConfigUnitTestReleaseGCSupport.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(NATIVE_ARCH)";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h";
|
||||
INFOPLIST_FILE = "Tests/Sparkle Unit Tests-Info.plist";
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
Cocoa,
|
||||
"-framework",
|
||||
SenTestingKit,
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = "Sparkle Unit Tests";
|
||||
WARNING_CFLAGS = "";
|
||||
WRAPPER_EXTENSION = octest;
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = "Release (GC dual-mode; 10.5-only)";
|
||||
};
|
||||
612279DB0DB5470300AB99EA /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = FA3AAF3A1050B273004B3130 /* ConfigUnitTestDebug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h";
|
||||
INFOPLIST_FILE = "Tests/Sparkle Unit Tests-Info.plist";
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
Cocoa,
|
||||
"-framework",
|
||||
SenTestingKit,
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = "Sparkle Unit Tests";
|
||||
WRAPPER_EXTENSION = octest;
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
612279DC0DB5470300AB99EA /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = FA3AAF391050B273004B3130 /* ConfigUnitTestRelease.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(NATIVE_ARCH)";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h";
|
||||
INFOPLIST_FILE = "Tests/Sparkle Unit Tests-Info.plist";
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
Cocoa,
|
||||
"-framework",
|
||||
SenTestingKit,
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = "Sparkle Unit Tests";
|
||||
WRAPPER_EXTENSION = octest;
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
+10
-4
@@ -1,15 +1,16 @@
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#import <unistd.h>
|
||||
|
||||
@interface TerminationListener : NSObject
|
||||
{
|
||||
@private
|
||||
const char *executablePath;
|
||||
pid_t parentProcessId;
|
||||
}
|
||||
|
||||
- (void) relaunch;
|
||||
- (void)relaunch __dead2;
|
||||
|
||||
@end
|
||||
|
||||
@@ -39,11 +40,16 @@
|
||||
- (void) relaunch
|
||||
{
|
||||
[[NSWorkspace sharedWorkspace] openFile:[[NSFileManager defaultManager] stringWithFileSystemRepresentation:executablePath length:strlen(executablePath)]];
|
||||
NSString* path = NSTemporaryDirectory();
|
||||
if (path)
|
||||
{
|
||||
path = [path stringByAppendingPathComponent:@"relaunch"];
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
[[NSFileManager defaultManager] removeFileAtPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"relaunch"] handler:nil];
|
||||
[[NSFileManager defaultManager] removeFileAtPath:path handler:nil];
|
||||
#else
|
||||
[[NSFileManager defaultManager] removeItemAtPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"relaunch"] error:NULL];
|
||||
[[NSFileManager defaultManager] removeItemAtPath:path error:nil];
|
||||
#endif
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user