mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-26 04:57:54 +00:00
Merge andymatuschak/Sparkle.
This commit is contained in:
commit
9937e5a17b
73 files changed
+3643
-807
No files matched your search
@@ -0,0 +1,9 @@
|
||||
// BinaryDelta tool only
|
||||
|
||||
PRODUCT_NAME = BinaryDelta
|
||||
GCC_PREFIX_HEADER =
|
||||
SDKROOT = macosx10.5
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=i386] = 10.5
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=ppc64] = 10.5
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=ppc] = 10.5
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=x86_64] = 10.5
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "ConfigCommon.xcconfig"
|
||||
#include "ConfigCommonDebug.xcconfig"
|
||||
#include "ConfigBinaryDelta.xcconfig"
|
||||
|
||||
OTHER_CFLAGS = -fsingle-precision-constant -DDEBUG
|
||||
@@ -0,0 +1,3 @@
|
||||
#include "ConfigCommon.xcconfig"
|
||||
#include "ConfigCommonRelease.xcconfig"
|
||||
#include "ConfigBinaryDelta.xcconfig"
|
||||
@@ -3,7 +3,7 @@
|
||||
PREBINDING = NO
|
||||
ZERO_LINK = NO
|
||||
CURRENT_PROJECT_VERSION = 1.5
|
||||
SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk
|
||||
SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=ppc] = 10.4
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=ppc64] = 10.5
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=i386] = 10.4
|
||||
@@ -14,8 +14,9 @@ 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_VERSION = 4.0;
|
||||
ARCHS = ppc i386
|
||||
GCC_ENABLE_PASCAL_STRINGS = NO
|
||||
ARCHS = ppc i386 x86_64
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0
|
||||
|
||||
// Enable warnings
|
||||
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES
|
||||
@@ -37,4 +38,13 @@ 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
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES
|
||||
WARNING_CFLAGS = -Wall -Wno-unused-parameter -Werror -Wundef -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-format-attribute -Wpacked -Wredundant-decls -Winline -Wdisabled-optimization -Wformat=2 -Winvalid-pch
|
||||
@@ -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
|
||||
+28
-1
@@ -123,4 +123,31 @@ Original SSLeay License
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
*/
|
||||
|
||||
License for bspatch.c and bsdiff.c, from bsdiff 4.3 (<http://www.daemonology.net/bsdiff/>:
|
||||
/*-
|
||||
* Copyright 2003-2005 Colin Percival
|
||||
* All rights reserved
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted providing that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
@interface NTSynchronousTask : NSObject
|
||||
{
|
||||
@private
|
||||
NSTask *mv_task;
|
||||
NSPipe *mv_outputPipe;
|
||||
NSPipe *mv_inputPipe;
|
||||
|
||||
+113
-152
@@ -13,154 +13,8 @@
|
||||
#import "SUVersionComparisonProtocol.h"
|
||||
#import "NTSynchronousTask.h"
|
||||
|
||||
@interface NTSynchronousTask (Private)
|
||||
- (void)run:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
|
||||
|
||||
- (NSTask *)task;
|
||||
- (void)setTask:(NSTask *)theTask;
|
||||
|
||||
- (NSPipe *)outputPipe;
|
||||
- (void)setOutputPipe:(NSPipe *)theOutputPipe;
|
||||
|
||||
- (NSPipe *)inputPipe;
|
||||
- (void)setInputPipe:(NSPipe *)theInputPipe;
|
||||
|
||||
- (NSData *)output;
|
||||
- (void)setOutput:(NSData *)theOutput;
|
||||
|
||||
- (BOOL)done;
|
||||
- (void)setDone:(BOOL)flag;
|
||||
|
||||
- (int)result;
|
||||
- (void)setResult:(int)theResult;
|
||||
@end
|
||||
|
||||
@implementation NTSynchronousTask
|
||||
|
||||
- (id)init;
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
[self setTask:[[[NSTask alloc] init] autorelease]];
|
||||
[self setOutputPipe:[[[NSPipe alloc] init] autorelease]];
|
||||
[self setInputPipe:[[[NSPipe alloc] init] autorelease]];
|
||||
|
||||
[[self task] setStandardInput:[self inputPipe]];
|
||||
[[self task] setStandardOutput:[self outputPipe]];
|
||||
[[self task] setStandardError:[self outputPipe]];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// dealloc
|
||||
//----------------------------------------------------------
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
[self setTask:nil];
|
||||
[self setOutputPipe:nil];
|
||||
[self setInputPipe:nil];
|
||||
[self setOutput:nil];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
+(int) task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input output: (NSData**)outData
|
||||
{
|
||||
// we need this wacky pool here, otherwise we run out of pipes, the pipes are internally autoreleased
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
int taskResult = 0;
|
||||
if( outData )
|
||||
*outData = nil;
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
NTSynchronousTask* task = [[NTSynchronousTask alloc] init];
|
||||
|
||||
[task run:toolPath directory:currentDirectory withArgs:args input:input];
|
||||
|
||||
taskResult = [task result];
|
||||
if( outData )
|
||||
*outData = [[task output] retain];
|
||||
|
||||
[task release];
|
||||
}
|
||||
NS_HANDLER;
|
||||
taskResult = errCppGeneral;
|
||||
NS_ENDHANDLER;
|
||||
|
||||
[pool drain];
|
||||
|
||||
// retained above
|
||||
if( outData )
|
||||
[*outData autorelease];
|
||||
|
||||
return taskResult;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NTSynchronousTask (Private)
|
||||
|
||||
- (void)run:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
|
||||
{
|
||||
BOOL success = NO;
|
||||
|
||||
if (currentDirectory)
|
||||
[[self task] setCurrentDirectoryPath: currentDirectory];
|
||||
|
||||
[[self task] setLaunchPath:toolPath];
|
||||
[[self task] setArguments:args];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(taskOutputAvailable:)
|
||||
name:NSFileHandleReadToEndOfFileCompletionNotification
|
||||
object:[[self outputPipe] fileHandleForReading]];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(taskDidTerminate:)
|
||||
name:NSTaskDidTerminateNotification
|
||||
object:[self task]];
|
||||
|
||||
[[[self outputPipe] fileHandleForReading] readToEndOfFileInBackgroundAndNotifyForModes:[NSArray arrayWithObjects:NSDefaultRunLoopMode, NSModalPanelRunLoopMode, NSEventTrackingRunLoopMode, nil]];
|
||||
|
||||
NS_DURING
|
||||
[[self task] launch];
|
||||
success = YES;
|
||||
NS_HANDLER
|
||||
;
|
||||
NS_ENDHANDLER
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (input)
|
||||
{
|
||||
// feed the running task our input
|
||||
[[[self inputPipe] fileHandleForWriting] writeData:input];
|
||||
[[[self inputPipe] fileHandleForWriting] closeFile];
|
||||
}
|
||||
|
||||
// loop until we are done receiving the data
|
||||
if (![self done])
|
||||
{
|
||||
double resolution = 1;
|
||||
BOOL isRunning;
|
||||
NSDate* next;
|
||||
|
||||
do {
|
||||
next = [NSDate dateWithTimeIntervalSinceNow:resolution];
|
||||
|
||||
isRunning = [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
|
||||
beforeDate:next];
|
||||
} while (isRunning && ![self done]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// task
|
||||
//----------------------------------------------------------
|
||||
@@ -251,10 +105,6 @@
|
||||
mv_result = theResult;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NTSynchronousTask (Notifications)
|
||||
|
||||
- (void)taskOutputAvailable:(NSNotification*)note
|
||||
{
|
||||
[self setOutput:[[note userInfo] objectForKey:NSFileHandleNotificationDataItem]];
|
||||
@@ -267,6 +117,117 @@
|
||||
[self setResult:[[self task] terminationStatus]];
|
||||
}
|
||||
|
||||
- (id)init;
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
[self setTask:[[[NSTask alloc] init] autorelease]];
|
||||
[self setOutputPipe:[[[NSPipe alloc] init] autorelease]];
|
||||
[self setInputPipe:[[[NSPipe alloc] init] autorelease]];
|
||||
|
||||
[[self task] setStandardInput:[self inputPipe]];
|
||||
[[self task] setStandardOutput:[self outputPipe]];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// dealloc
|
||||
//----------------------------------------------------------
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
[mv_task release];
|
||||
[mv_outputPipe release];
|
||||
[mv_inputPipe release];
|
||||
[mv_output release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)run:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
|
||||
{
|
||||
BOOL success = NO;
|
||||
|
||||
if (currentDirectory)
|
||||
[[self task] setCurrentDirectoryPath: currentDirectory];
|
||||
|
||||
[[self task] setLaunchPath:toolPath];
|
||||
[[self task] setArguments:args];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(taskOutputAvailable:)
|
||||
name:NSFileHandleReadToEndOfFileCompletionNotification
|
||||
object:[[self outputPipe] fileHandleForReading]];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(taskDidTerminate:)
|
||||
name:NSTaskDidTerminateNotification
|
||||
object:[self task]];
|
||||
|
||||
[[[self outputPipe] fileHandleForReading] readToEndOfFileInBackgroundAndNotifyForModes:[NSArray arrayWithObjects:NSDefaultRunLoopMode, NSModalPanelRunLoopMode, NSEventTrackingRunLoopMode, nil]];
|
||||
|
||||
@try
|
||||
{
|
||||
[[self task] launch];
|
||||
success = YES;
|
||||
}
|
||||
@catch (NSException *localException) { }
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (input)
|
||||
{
|
||||
// feed the running task our input
|
||||
[[[self inputPipe] fileHandleForWriting] writeData:input];
|
||||
[[[self inputPipe] fileHandleForWriting] closeFile];
|
||||
}
|
||||
|
||||
// loop until we are done receiving the data
|
||||
if (![self done])
|
||||
{
|
||||
double resolution = 1;
|
||||
BOOL isRunning;
|
||||
NSDate* next;
|
||||
|
||||
do {
|
||||
next = [NSDate dateWithTimeIntervalSinceNow:resolution];
|
||||
|
||||
isRunning = [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
|
||||
beforeDate:next];
|
||||
} while (isRunning && ![self done]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSData*)task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
|
||||
{
|
||||
// we need this wacky pool here, otherwise we run out of pipes, the pipes are internally autoreleased
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSData* result=nil;
|
||||
|
||||
@try
|
||||
{
|
||||
NTSynchronousTask* task = [[NTSynchronousTask alloc] init];
|
||||
|
||||
[task run:toolPath directory:currentDirectory withArgs:args input:input];
|
||||
|
||||
if ([task result] == 0)
|
||||
result = [[task output] retain];
|
||||
|
||||
[task release];
|
||||
}
|
||||
@catch (NSException *localException) { }
|
||||
|
||||
[pool drain];
|
||||
|
||||
// retained above
|
||||
[result autorelease];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+4
-1
@@ -10,11 +10,14 @@
|
||||
#define SUAPPCAST_H
|
||||
|
||||
@class SUAppcastItem;
|
||||
@interface SUAppcast : NSObject {
|
||||
@interface SUAppcast : NSObject
|
||||
{
|
||||
@private
|
||||
NSArray *items;
|
||||
NSString *userAgentString;
|
||||
id delegate;
|
||||
NSString *downloadFilename;
|
||||
NSURLDownload *download;
|
||||
}
|
||||
|
||||
- (void)fetchAppcastFromURL:(NSURL *)url;
|
||||
|
||||
+63
-37
@@ -15,6 +15,22 @@
|
||||
#import "SUConstants.h"
|
||||
#import "SULog.h"
|
||||
|
||||
@interface NSXMLElement (SUAppcastExtensions)
|
||||
- (NSDictionary *)attributesAsDictionary;
|
||||
@end
|
||||
|
||||
@implementation NSXMLElement (SUAppcastExtensions)
|
||||
- (NSDictionary *)attributesAsDictionary
|
||||
{
|
||||
NSEnumerator *attributeEnum = [[self attributes] objectEnumerator];
|
||||
NSXMLNode *attribute;
|
||||
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
|
||||
|
||||
while ((attribute = [attributeEnum nextObject]))
|
||||
[dictionary setObject:[attribute stringValue] forKey:[attribute name]];
|
||||
return dictionary;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface SUAppcast (Private)
|
||||
- (void)reportError:(NSError *)error;
|
||||
@@ -31,6 +47,8 @@
|
||||
userAgentString = nil;
|
||||
[downloadFilename release];
|
||||
downloadFilename = nil;
|
||||
[download release];
|
||||
download = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -46,44 +64,50 @@
|
||||
if (userAgentString)
|
||||
[request setValue:userAgentString forHTTPHeaderField:@"User-Agent"];
|
||||
|
||||
NSURLDownload *download = [[[NSURLDownload alloc] initWithRequest:request delegate:self] autorelease];
|
||||
CFRetain(download);
|
||||
download = [[NSURLDownload alloc] initWithRequest:request delegate:self];
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename
|
||||
- (void)download:(NSURLDownload *)aDownload 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
|
||||
- (void)download:(NSURLDownload *)aDownload didCreateDestination:(NSString *)path
|
||||
{
|
||||
[downloadFilename release];
|
||||
downloadFilename = [path copy];
|
||||
}
|
||||
|
||||
- (void)downloadDidFinish:(NSURLDownload *)download
|
||||
{
|
||||
CFRelease(download);
|
||||
|
||||
- (void)downloadDidFinish:(NSURLDownload *)aDownload
|
||||
{
|
||||
NSError *error = nil;
|
||||
NSXMLDocument *document = [[NSXMLDocument alloc] initWithContentsOfURL:[NSURL fileURLWithPath:downloadFilename] options:0 error:&error];
|
||||
|
||||
NSXMLDocument *document = nil;
|
||||
BOOL failed = NO;
|
||||
NSArray *xmlItems = nil;
|
||||
NSMutableArray *appcastItems = [NSMutableArray array];
|
||||
|
||||
#if DEBUG
|
||||
NSString* debugXML = [NSString stringWithContentsOfFile: downloadFilename encoding: NSUTF8StringEncoding error: nil];
|
||||
SULog(@"<<<< XML >>>>\n%@\n>>>> XML <<<<", debugXML);
|
||||
#endif
|
||||
|
||||
if (downloadFilename)
|
||||
{
|
||||
document = [[[NSXMLDocument alloc] initWithContentsOfURL:[NSURL fileURLWithPath:downloadFilename] options:0 error:&error] autorelease];
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
[[NSFileManager defaultManager] removeFileAtPath:downloadFilename handler:nil];
|
||||
[[NSFileManager defaultManager] removeFileAtPath:downloadFilename handler:nil];
|
||||
#else
|
||||
[[NSFileManager defaultManager] removeItemAtPath:downloadFilename error:NULL];
|
||||
[[NSFileManager defaultManager] removeItemAtPath:downloadFilename error:nil];
|
||||
#endif
|
||||
[downloadFilename release];
|
||||
downloadFilename = nil;
|
||||
[downloadFilename release];
|
||||
downloadFilename = nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
failed = YES;
|
||||
}
|
||||
|
||||
if (nil == document)
|
||||
{
|
||||
@@ -137,12 +161,7 @@
|
||||
if ([name isEqualToString:@"enclosure"])
|
||||
{
|
||||
// enclosure is flattened as a separate dictionary for some reason
|
||||
NSEnumerator *attributeEnum = [[(NSXMLElement *)node attributes] objectEnumerator];
|
||||
NSXMLNode *attribute;
|
||||
NSMutableDictionary *encDict = [NSMutableDictionary dictionary];
|
||||
|
||||
while ((attribute = [attributeEnum nextObject]))
|
||||
[encDict setObject:[attribute stringValue] forKey:[attribute name]];
|
||||
NSDictionary *encDict = [(NSXMLElement *)node attributesAsDictionary];
|
||||
[dict setObject:encDict forKey:@"enclosure"];
|
||||
|
||||
}
|
||||
@@ -153,19 +172,29 @@
|
||||
if (date)
|
||||
[dict setObject:date forKey:name];
|
||||
}
|
||||
else if (name != nil)
|
||||
{
|
||||
else if ([name isEqualToString:@"sparkle:deltas"])
|
||||
{
|
||||
NSMutableArray *deltas = [NSMutableArray array];
|
||||
NSEnumerator *childEnum = [[node children] objectEnumerator];
|
||||
NSXMLNode *child;
|
||||
while ((child = [childEnum nextObject])) {
|
||||
if ([[child name] isEqualToString:@"enclosure"])
|
||||
[deltas addObject:[(NSXMLElement *)child attributesAsDictionary]];
|
||||
}
|
||||
[dict setObject:deltas forKey:@"deltas"];
|
||||
}
|
||||
else if (name != nil)
|
||||
{
|
||||
// add all other values as strings
|
||||
[dict setObject:[[node stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] forKey:name];
|
||||
}
|
||||
}
|
||||
|
||||
NSString *errString;
|
||||
SUAppcastItem *anItem = [[SUAppcastItem alloc] initWithDictionary:dict failureReason:&errString];
|
||||
SUAppcastItem *anItem = [[[SUAppcastItem alloc] initWithDictionary:dict failureReason:&errString] autorelease];
|
||||
if (anItem)
|
||||
{
|
||||
[appcastItems addObject:anItem];
|
||||
[anItem release];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -175,8 +204,6 @@
|
||||
[dict removeAllObjects];
|
||||
}
|
||||
}
|
||||
|
||||
[document release];
|
||||
|
||||
if ([appcastItems count])
|
||||
{
|
||||
@@ -195,15 +222,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error
|
||||
- (void)download:(NSURLDownload *)aDownload didFailWithError:(NSError *)error
|
||||
{
|
||||
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];
|
||||
@@ -212,7 +238,7 @@
|
||||
[self reportError:error];
|
||||
}
|
||||
|
||||
- (NSURLRequest *)download:(NSURLDownload *)download willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse
|
||||
- (NSURLRequest *)download:(NSURLDownload *)aDownload willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse
|
||||
{
|
||||
return request;
|
||||
}
|
||||
@@ -237,7 +263,7 @@
|
||||
NSXMLElement *node;
|
||||
NSMutableArray *languages = [NSMutableArray array];
|
||||
NSString *lang;
|
||||
NSInteger i;
|
||||
NSUInteger i;
|
||||
while ((node = [nodeEnum nextObject]))
|
||||
{
|
||||
lang = [[node attributeForName:@"xml:lang"] stringValue];
|
||||
|
||||
+8
-2
@@ -9,7 +9,9 @@
|
||||
#ifndef SUAPPCASTITEM_H
|
||||
#define SUAPPCASTITEM_H
|
||||
|
||||
@interface SUAppcastItem : NSObject {
|
||||
@interface SUAppcastItem : NSObject
|
||||
{
|
||||
@private
|
||||
NSString *title;
|
||||
NSDate *date;
|
||||
NSString *itemDescription;
|
||||
@@ -22,7 +24,9 @@
|
||||
NSURL *fileURL;
|
||||
NSString *versionString;
|
||||
NSString *displayVersionString;
|
||||
|
||||
|
||||
NSDictionary *deltaUpdates;
|
||||
|
||||
NSDictionary *propertiesDictionary;
|
||||
|
||||
NSURL *infoURL; // UK 2007-08-31
|
||||
@@ -41,6 +45,8 @@
|
||||
- (NSURL *)fileURL;
|
||||
- (NSString *)DSASignature;
|
||||
- (NSString *)minimumSystemVersion;
|
||||
- (NSDictionary *)deltaUpdates;
|
||||
- (BOOL)isDeltaUpdate;
|
||||
|
||||
// Returns the dictionary provided in initWithDictionary; this might be useful later for extensions.
|
||||
- (NSDictionary *)propertiesDictionary;
|
||||
|
||||
@@ -116,6 +116,20 @@
|
||||
infoURL = [aFileURL copy];
|
||||
}
|
||||
|
||||
- (NSDictionary *)deltaUpdates { return [[deltaUpdates retain] autorelease]; }
|
||||
|
||||
- (void)setDeltaUpdates:(NSDictionary *)updates
|
||||
{
|
||||
if (deltaUpdates == updates) return;
|
||||
[deltaUpdates release];
|
||||
deltaUpdates = [updates copy];
|
||||
}
|
||||
|
||||
- (BOOL)isDeltaUpdate
|
||||
{
|
||||
return [[propertiesDictionary objectForKey:@"enclosure"] objectForKey:@"sparkle:deltaFrom"] != nil;
|
||||
}
|
||||
|
||||
- initWithDictionary:(NSDictionary *)dict
|
||||
{
|
||||
return [self initWithDictionary:dict failureReason:nil];
|
||||
@@ -210,6 +224,26 @@
|
||||
[self setReleaseNotesURL:[NSURL URLWithString:[self itemDescription]]];
|
||||
else
|
||||
[self setReleaseNotesURL:nil];
|
||||
|
||||
if ([dict objectForKey:@"deltas"])
|
||||
{
|
||||
NSMutableDictionary *deltas = [NSMutableDictionary dictionary];
|
||||
NSArray *deltaDictionaries = [dict objectForKey:@"deltas"];
|
||||
NSEnumerator *deltaDictionariesEnum = [deltaDictionaries objectEnumerator];
|
||||
NSDictionary *deltaDictionary;
|
||||
while ((deltaDictionary = [deltaDictionariesEnum nextObject]))
|
||||
{
|
||||
NSMutableDictionary *fakeAppCastDict = [dict mutableCopy];
|
||||
[fakeAppCastDict removeObjectForKey:@"deltas"];
|
||||
[fakeAppCastDict setObject:deltaDictionary forKey:@"enclosure"];
|
||||
SUAppcastItem *deltaItem = [[[self class] alloc] initWithDictionary:fakeAppCastDict];
|
||||
[fakeAppCastDict release];
|
||||
|
||||
[deltas setObject:deltaItem forKey:[deltaDictionary objectForKey:@"sparkle:deltaFrom"]];
|
||||
[deltaItem release];
|
||||
}
|
||||
[self setDeltaUpdates:deltas];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -221,6 +255,7 @@
|
||||
[self setItemDescription:nil];
|
||||
[self setReleaseNotesURL:nil];
|
||||
[self setDSASignature:nil];
|
||||
[self setMinimumSystemVersion: nil];
|
||||
[self setFileURL:nil];
|
||||
[self setVersionString:nil];
|
||||
[self setDisplayVersionString:nil];
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
#import "SUBasicUpdateDriver.h"
|
||||
|
||||
@class SUAutomaticUpdateAlert;
|
||||
@interface SUAutomaticUpdateDriver : SUBasicUpdateDriver {
|
||||
@interface SUAutomaticUpdateDriver : SUBasicUpdateDriver
|
||||
{
|
||||
@private
|
||||
BOOL postponingInstallation, showErrors;
|
||||
SUAutomaticUpdateAlert *alert;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
@class SUAppcastItem, SUUnarchiver, SUAppcast, SUUnarchiver, SUHost;
|
||||
@interface SUBasicUpdateDriver : SUUpdateDriver {
|
||||
SUAppcastItem *updateItem;
|
||||
SUAppcastItem *nonDeltaUpdateItem;
|
||||
|
||||
NSURLDownload *download;
|
||||
NSString *downloadPath;
|
||||
@@ -43,6 +44,7 @@
|
||||
- (void)extractUpdate;
|
||||
- (void)unarchiverDidFinish:(SUUnarchiver *)ua;
|
||||
- (void)unarchiverDidFail:(SUUnarchiver *)ua;
|
||||
- (void)failedToApplyDeltaUpdate;
|
||||
|
||||
- (void)installUpdate;
|
||||
- (void)installerForHost:(SUHost *)host failedWithError:(NSError *)error;
|
||||
|
||||
+37
-9
@@ -17,6 +17,7 @@
|
||||
#import "SULog.h"
|
||||
#import "SUPlainInstaller.h"
|
||||
#import "SUPlainInstallerInternals.h"
|
||||
#import "SUBinaryDeltaCommon.h"
|
||||
|
||||
|
||||
@implementation SUBasicUpdateDriver
|
||||
@@ -39,7 +40,7 @@
|
||||
[appcast fetchAppcastFromURL:URL];
|
||||
}
|
||||
|
||||
- (id <SUVersionComparison>)_versionComparator
|
||||
- (id <SUVersionComparison>)versionComparator
|
||||
{
|
||||
id <SUVersionComparison> comparator = nil;
|
||||
|
||||
@@ -56,7 +57,7 @@
|
||||
|
||||
- (BOOL)isItemNewer:(SUAppcastItem *)ui
|
||||
{
|
||||
return [[self _versionComparator] compareVersion:[host version] toVersion:[ui versionString]] == NSOrderedAscending;
|
||||
return [[self versionComparator] compareVersion:[host version] toVersion:[ui versionString]] == NSOrderedAscending;
|
||||
}
|
||||
|
||||
- (BOOL)hostSupportsItem:(SUAppcastItem *)ui
|
||||
@@ -69,7 +70,7 @@
|
||||
{
|
||||
NSString *skippedVersion = [host objectForUserDefaultsKey:SUSkippedVersionKey];
|
||||
if (skippedVersion == nil) { return NO; }
|
||||
return [[self _versionComparator] compareVersion:[ui versionString] toVersion:skippedVersion] != NSOrderedDescending;
|
||||
return [[self versionComparator] compareVersion:[ui versionString] toVersion:skippedVersion] != NSOrderedDescending;
|
||||
}
|
||||
|
||||
- (BOOL)itemContainsValidUpdate:(SUAppcastItem *)ui
|
||||
@@ -96,10 +97,18 @@
|
||||
do {
|
||||
item = [updateEnumerator nextObject];
|
||||
} while (item && ![self hostSupportsItem:item]);
|
||||
|
||||
if (binaryDeltaSupported()) {
|
||||
SUAppcastItem *deltaUpdateItem = [[item deltaUpdates] objectForKey:[host version]];
|
||||
if (deltaUpdateItem && [self hostSupportsItem:deltaUpdateItem]) {
|
||||
nonDeltaUpdateItem = [item retain];
|
||||
item = deltaUpdateItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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])
|
||||
@@ -110,7 +119,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];
|
||||
}
|
||||
|
||||
@@ -206,7 +215,7 @@
|
||||
|
||||
- (void)extractUpdate
|
||||
{
|
||||
SUUnarchiver *unarchiver = [SUUnarchiver unarchiverForPath:downloadPath];
|
||||
SUUnarchiver *unarchiver = [SUUnarchiver unarchiverForPath:downloadPath updatingHost:host];
|
||||
if (!unarchiver)
|
||||
{
|
||||
SULog(@"Sparkle Error: No valid unarchiver for %@!", downloadPath);
|
||||
@@ -218,6 +227,16 @@
|
||||
[unarchiver start];
|
||||
}
|
||||
|
||||
- (void)failedToApplyDeltaUpdate
|
||||
{
|
||||
// When a delta update fails to apply we fall back on updating via a full install.
|
||||
[updateItem release];
|
||||
updateItem = nonDeltaUpdateItem;
|
||||
nonDeltaUpdateItem = nil;
|
||||
|
||||
[self downloadUpdate];
|
||||
}
|
||||
|
||||
- (void)unarchiverDidFinish:(SUUnarchiver *)ua
|
||||
{
|
||||
if (ua) { CFRelease(ua); }
|
||||
@@ -227,6 +246,12 @@
|
||||
- (void)unarchiverDidFail:(SUUnarchiver *)ua
|
||||
{
|
||||
if (ua) { CFRelease(ua); }
|
||||
|
||||
if ([updateItem isDeltaUpdate]) {
|
||||
[self failedToApplyDeltaUpdate];
|
||||
return;
|
||||
}
|
||||
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:[NSDictionary dictionaryWithObject:SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil) forKey:NSLocalizedDescriptionKey]]];
|
||||
}
|
||||
|
||||
@@ -236,10 +261,12 @@
|
||||
{
|
||||
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:@"finish_installation" ofType:@"app"];
|
||||
NSString *appSupportFolder = [[@"~/Library/Application Support/" stringByExpandingTildeInPath] stringByAppendingPathComponent: [host name]];
|
||||
NSString *targetPath = [appSupportFolder stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];
|
||||
NSString *relaunchPathToCopy = [SPARKLE_BUNDLE 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;
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath: [targetPath stringByDeletingLastPathComponent] attributes: [NSDictionary dictionary]];
|
||||
#else
|
||||
@@ -335,6 +362,7 @@
|
||||
- (void)dealloc
|
||||
{
|
||||
[updateItem release];
|
||||
[nonDeltaUpdateItem release];
|
||||
[download release];
|
||||
[downloadPath release];
|
||||
[tempDir release];
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// SUBinaryDeltaApply.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mark Rowe on 2009-06-01.
|
||||
// Copyright 2009 Mark Rowe. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SUBINARYDELTAAPPLY_H
|
||||
#define SUBINARYDELTAAPPLY_H
|
||||
|
||||
@class NSString;
|
||||
int applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFile);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// SUBinaryDeltaApply.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mark Rowe on 2009-06-01.
|
||||
// Copyright 2009 Mark Rowe. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUBinaryDeltaApply.h"
|
||||
#import "SUBinaryDeltaCommon.h"
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <bspatch.h>
|
||||
#import <stdio.h>
|
||||
#import <stdlib.h>
|
||||
#import <xar/xar.h>
|
||||
|
||||
static void applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFilePath, NSString *destinationFilePath)
|
||||
{
|
||||
NSString *patchFile = temporaryFilename(@"apply-binary-delta");
|
||||
xar_extract_tofile(x, file, [patchFile fileSystemRepresentation]);
|
||||
const char *argv[] = {"/usr/bin/bspatch", [sourceFilePath fileSystemRepresentation], [destinationFilePath fileSystemRepresentation], [patchFile fileSystemRepresentation]};
|
||||
bspatch(4, (char **)argv);
|
||||
unlink([patchFile fileSystemRepresentation]);
|
||||
}
|
||||
|
||||
int applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFile)
|
||||
{
|
||||
xar_t x = xar_open([patchFile UTF8String], READ);
|
||||
if (!x) {
|
||||
fprintf(stderr, "Unable to open %s. Giving up.\n", [patchFile UTF8String]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
NSString *expectedBeforeHash = nil;
|
||||
NSString *expectedAfterHash = nil;
|
||||
xar_subdoc_t subdoc;
|
||||
for (subdoc = xar_subdoc_first(x); subdoc; subdoc = xar_subdoc_next(subdoc)) {
|
||||
if (!strcmp(xar_subdoc_name(subdoc), "binary-delta-attributes")) {
|
||||
const char *value = 0;
|
||||
xar_subdoc_prop_get(subdoc, "before-sha1", &value);
|
||||
if (value)
|
||||
expectedBeforeHash = [NSString stringWithUTF8String:value];
|
||||
|
||||
xar_subdoc_prop_get(subdoc, "after-sha1", &value);
|
||||
if (value)
|
||||
expectedAfterHash = [NSString stringWithUTF8String:value];
|
||||
}
|
||||
}
|
||||
|
||||
if (!expectedBeforeHash || !expectedAfterHash) {
|
||||
fprintf(stderr, "Unable to find before-sha1 or after-sha1 metadata in delta. Giving up.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Verifying source... ");
|
||||
NSString *beforeHash = hashOfTree(source);
|
||||
|
||||
if (![beforeHash isEqualToString:expectedBeforeHash]) {
|
||||
fprintf(stderr, "Source doesn't have expected hash (%s != %s). Giving up.\n", [expectedBeforeHash UTF8String], [beforeHash UTF8String]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fprintf(stderr, "\nCopying files... ");
|
||||
removeTree(destination);
|
||||
copyTree(source, destination);
|
||||
|
||||
fprintf(stderr, "\nPatching... ");
|
||||
xar_file_t file;
|
||||
xar_iter_t iter = xar_iter_new();
|
||||
for (file = xar_file_first(x, iter); file; file = xar_file_next(iter)) {
|
||||
NSString *path = [NSString stringWithUTF8String:xar_get_path(file)];
|
||||
NSString *sourceFilePath = [source stringByAppendingPathComponent:path];
|
||||
NSString *destinationFilePath = [destination stringByAppendingPathComponent:path];
|
||||
|
||||
const char *value;
|
||||
if (!xar_prop_get(file, "delete", &value) || !xar_prop_get(file, "delete-then-extract", &value)) {
|
||||
removeTree(destinationFilePath);
|
||||
if (!xar_prop_get(file, "delete", &value))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!xar_prop_get(file, "binary-delta", &value))
|
||||
applyBinaryDeltaToFile(x, file, sourceFilePath, destinationFilePath);
|
||||
else
|
||||
xar_extract_tofile(x, file, [destinationFilePath fileSystemRepresentation]);
|
||||
}
|
||||
xar_close(x);
|
||||
|
||||
fprintf(stderr, "\nVerifying destination... ");
|
||||
NSString *afterHash = hashOfTree(destination);
|
||||
|
||||
if (![afterHash isEqualToString:expectedAfterHash]) {
|
||||
fprintf(stderr, "Destination doesn't have expected hash (%s != %s). Giving up.\n", [expectedAfterHash UTF8String], [afterHash UTF8String]);
|
||||
removeTree(destination);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fprintf(stderr, "\nDone!\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// SUBinaryDeltaCommon.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mark Rowe on 2009-06-01.
|
||||
// Copyright 2009 Mark Rowe. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SUBINARYDELTACOMMON_H
|
||||
#define SUBINARYDELTACOMMON_H
|
||||
|
||||
#include <fts.h>
|
||||
|
||||
@class NSString;
|
||||
@class NSData;
|
||||
|
||||
extern int binaryDeltaSupported(void);
|
||||
extern int compareFiles(const FTSENT **a, const FTSENT **b);
|
||||
extern NSData *hashOfFile(FTSENT *ent);
|
||||
extern NSString *hashOfTree(NSString *path);
|
||||
extern void removeTree(NSString *path);
|
||||
extern void copyTree(NSString *source, NSString *dest);
|
||||
extern NSString *pathRelativeToDirectory(NSString *directory, NSString *path);
|
||||
NSString *temporaryFilename(NSString *base);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,165 @@
|
||||
//
|
||||
// SUBinaryDeltaCommon.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mark Rowe on 2009-06-01.
|
||||
// Copyright 2009 Mark Rowe. All rights reserved.
|
||||
//
|
||||
|
||||
#include "SUBinaryDeltaCommon.h"
|
||||
#include <CommonCrypto/CommonDigest.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
extern int xar_close(void*) __attribute__((weak_import));
|
||||
|
||||
int binaryDeltaSupported(void)
|
||||
{
|
||||
// OS X 10.4 didn't include libxar, so we link against it weakly.
|
||||
// This checks whether libxar is available at runtime.
|
||||
return xar_close != 0;
|
||||
}
|
||||
|
||||
int compareFiles(const FTSENT **a, const FTSENT **b)
|
||||
{
|
||||
return strcoll((*a)->fts_name, (*b)->fts_name);
|
||||
}
|
||||
|
||||
NSString *pathRelativeToDirectory(NSString *directory, NSString *path)
|
||||
{
|
||||
NSUInteger directoryLength = [directory length];
|
||||
if ([path hasPrefix:directory])
|
||||
return [path substringFromIndex:directoryLength];
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
NSString *temporaryFilename(NSString *base)
|
||||
{
|
||||
NSString *template = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.XXXXXXXXXX", base]];
|
||||
char buffer[MAXPATHLEN];
|
||||
strcpy(buffer, [template fileSystemRepresentation]);
|
||||
return [NSString stringWithUTF8String:mktemp(buffer)];
|
||||
}
|
||||
|
||||
static void _hashOfBuffer(unsigned char *hash, const char* buffer, size_t bufferLength)
|
||||
{
|
||||
assert(bufferLength <= UINT32_MAX);
|
||||
CC_SHA1_CTX hashContext;
|
||||
CC_SHA1_Init(&hashContext);
|
||||
CC_SHA1_Update(&hashContext, buffer, (CC_LONG)bufferLength);
|
||||
CC_SHA1_Final(hash, &hashContext);
|
||||
}
|
||||
|
||||
static void _hashOfFile(unsigned char* hash, FTSENT *ent)
|
||||
{
|
||||
if (ent->fts_info == FTS_SL) {
|
||||
char linkDestination[MAXPATHLEN + 1];
|
||||
ssize_t linkDestinationLength = readlink(ent->fts_path, linkDestination, MAXPATHLEN);
|
||||
if (linkDestinationLength < 0) {
|
||||
perror("readlink");
|
||||
return;
|
||||
}
|
||||
|
||||
_hashOfBuffer(hash, linkDestination, linkDestinationLength);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ent->fts_info == FTS_F) {
|
||||
int fileDescriptor = open(ent->fts_path, O_RDONLY);
|
||||
if (fileDescriptor == -1) {
|
||||
perror("open");
|
||||
return;
|
||||
}
|
||||
|
||||
size_t fileSize = (size_t)ent->fts_statp->st_size;
|
||||
if (fileSize == 0) {
|
||||
_hashOfBuffer(hash, NULL, 0);
|
||||
close(fileDescriptor);
|
||||
return;
|
||||
}
|
||||
|
||||
void *buffer = mmap(0, fileSize, PROT_READ, MAP_FILE | MAP_PRIVATE, fileDescriptor, 0);
|
||||
if (buffer == (void*)-1) {
|
||||
close(fileDescriptor);
|
||||
perror("mmap");
|
||||
return;
|
||||
}
|
||||
|
||||
_hashOfBuffer(hash, buffer, fileSize);
|
||||
munmap(buffer, fileSize);
|
||||
close(fileDescriptor);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ent->fts_info == FTS_D)
|
||||
memset(hash, 0xdd, CC_SHA1_DIGEST_LENGTH);
|
||||
}
|
||||
|
||||
NSData *hashOfFile(FTSENT *ent)
|
||||
{
|
||||
unsigned char fileHash[CC_SHA1_DIGEST_LENGTH];
|
||||
_hashOfFile(fileHash, ent);
|
||||
return [NSData dataWithBytes:fileHash length:CC_SHA1_DIGEST_LENGTH];
|
||||
}
|
||||
|
||||
NSString *hashOfTree(NSString *path)
|
||||
{
|
||||
const char *sourcePaths[] = {[path UTF8String], 0};
|
||||
FTS *fts = fts_open((char* const*)sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||
if (!fts) {
|
||||
perror("fts_open");
|
||||
return nil;
|
||||
}
|
||||
|
||||
CC_SHA1_CTX hashContext;
|
||||
CC_SHA1_Init(&hashContext);
|
||||
|
||||
FTSENT *ent = 0;
|
||||
while ((ent = fts_read(fts))) {
|
||||
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL)
|
||||
continue;
|
||||
|
||||
unsigned char fileHash[CC_SHA1_DIGEST_LENGTH];
|
||||
_hashOfFile(fileHash, ent);
|
||||
CC_SHA1_Update(&hashContext, fileHash, sizeof(fileHash));
|
||||
|
||||
NSString *relativePath = pathRelativeToDirectory(path, [NSString stringWithUTF8String:ent->fts_path]);
|
||||
NSData *relativePathBytes = [relativePath dataUsingEncoding:NSUTF8StringEncoding];
|
||||
CC_SHA1_Update(&hashContext, [relativePathBytes bytes], (uint32_t)[relativePathBytes length]);
|
||||
}
|
||||
fts_close(fts);
|
||||
|
||||
unsigned char hash[CC_SHA1_DIGEST_LENGTH];
|
||||
CC_SHA1_Final(hash, &hashContext);
|
||||
|
||||
char hexHash[CC_SHA1_DIGEST_LENGTH * 2 + 1];
|
||||
size_t i;
|
||||
for (i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
|
||||
sprintf(hexHash + i * 2, "%02x", hash[i]);
|
||||
|
||||
return [NSString stringWithUTF8String:hexHash];
|
||||
}
|
||||
|
||||
void removeTree(NSString *path)
|
||||
{
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4
|
||||
[[NSFileManager defaultManager] removeItemAtPath:path error:0];
|
||||
#else
|
||||
[[NSFileManager defaultManager] removeFileAtPath:path handler:nil];
|
||||
#endif
|
||||
}
|
||||
|
||||
void copyTree(NSString *source, NSString *dest)
|
||||
{
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4
|
||||
[[NSFileManager defaultManager] copyItemAtPath:source toPath:dest error:0];
|
||||
#else
|
||||
[[NSFileManager defaultManager] copyPath:source toPath:dest handler:nil];
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,269 @@
|
||||
//
|
||||
// SUBinaryDeltaTool.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mark Rowe on 2009-06-01.
|
||||
// Copyright 2009 Mark Rowe. All rights reserved.
|
||||
//
|
||||
|
||||
#define _DARWIN_NO_64_BIT_INODE 1
|
||||
|
||||
#include "SUBinaryDeltaCommon.h"
|
||||
#include "SUBinaryDeltaApply.h"
|
||||
#include <CommonCrypto/CommonDigest.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <fcntl.h>
|
||||
#include <fts.h>
|
||||
#include <libgen.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <xar/xar.h>
|
||||
|
||||
extern int bsdiff(int argc, const char **argv);
|
||||
|
||||
@interface CreateBinaryDeltaOperation : NSOperation
|
||||
{
|
||||
NSString *_relativePath;
|
||||
NSString *_fromPath;
|
||||
NSString *_toPath;
|
||||
NSString *_resultPath;
|
||||
}
|
||||
- (id)initWithRelativePath:(NSString *)relativePath oldTree:(NSString *)oldTree newTree:(NSString *)newTree;
|
||||
|
||||
- (NSString *)relativePath;
|
||||
- (NSString *)resultPath;
|
||||
@end
|
||||
|
||||
@implementation CreateBinaryDeltaOperation
|
||||
|
||||
- (id)initWithRelativePath:(NSString *)relativePath oldTree:(NSString *)oldTree newTree:(NSString *)newTree
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_relativePath = [relativePath copy];
|
||||
_fromPath = [[oldTree stringByAppendingPathComponent:relativePath] retain];
|
||||
_toPath = [[newTree stringByAppendingPathComponent:relativePath] retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)relativePath
|
||||
{
|
||||
return [[_relativePath retain] autorelease];
|
||||
}
|
||||
|
||||
- (NSString *)resultPath
|
||||
{
|
||||
return [[_resultPath retain] autorelease];
|
||||
}
|
||||
|
||||
- (void)main
|
||||
{
|
||||
NSString *temporaryFile = temporaryFilename(@"BinaryDelta");
|
||||
const char *argv[] = {"/usr/bin/bsdiff", [_fromPath fileSystemRepresentation], [_toPath fileSystemRepresentation], [temporaryFile fileSystemRepresentation]};
|
||||
int result = bsdiff(4, argv);
|
||||
if (!result)
|
||||
_resultPath = [temporaryFile retain];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static NSDictionary *infoForFile(FTSENT *ent)
|
||||
{
|
||||
NSData *hash = hashOfFile(ent);
|
||||
NSNumber *size = nil;
|
||||
if (ent->fts_info != FTS_D)
|
||||
size = [NSNumber numberWithUnsignedLongLong:ent->fts_statp->st_size];
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:hash, @"hash", [NSNumber numberWithUnsignedShort:ent->fts_info], @"type", size, @"size", nil];
|
||||
}
|
||||
|
||||
static NSString *absolutePath(NSString *path)
|
||||
{
|
||||
NSURL *url = [[[NSURL alloc] initFileURLWithPath:path] autorelease];
|
||||
return [[url absoluteURL] path];
|
||||
}
|
||||
|
||||
static NSString *temporaryPatchFile(NSString *patchFile)
|
||||
{
|
||||
NSString *path = absolutePath(patchFile);
|
||||
NSString *directory = [path stringByDeletingLastPathComponent];
|
||||
NSString *file = [path lastPathComponent];
|
||||
return [NSString stringWithFormat:@"%@/.%@.tmp", directory, file];
|
||||
}
|
||||
|
||||
static BOOL shouldSkipDeltaCompression(NSString *key, NSDictionary* originalInfo, NSDictionary *newInfo)
|
||||
{
|
||||
unsigned long long fileSize = [[newInfo objectForKey:@"size"] unsignedLongLongValue];
|
||||
if (fileSize < 4096)
|
||||
return YES;
|
||||
|
||||
if (!originalInfo)
|
||||
return YES;
|
||||
|
||||
if ([[originalInfo objectForKey:@"type"] unsignedShortValue] != [[newInfo objectForKey:@"type"] unsignedShortValue])
|
||||
return YES;
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
static BOOL shouldDeleteThenExtract(NSString *key, NSDictionary* originalInfo, NSDictionary *newInfo)
|
||||
{
|
||||
if (!originalInfo)
|
||||
return NO;
|
||||
|
||||
if ([[originalInfo objectForKey:@"type"] unsignedShortValue] != [[newInfo objectForKey:@"type"] unsignedShortValue])
|
||||
return YES;
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 5) {
|
||||
usage:
|
||||
fprintf(stderr, "Usage: BinaryDelta [create | apply] before-tree after-tree patch-file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSString *command = [NSString stringWithUTF8String:argv[1]];
|
||||
NSString *oldPath = [NSString stringWithUTF8String:argv[2]];
|
||||
NSString *newPath = [NSString stringWithUTF8String:argv[3]];
|
||||
NSString *patchFile = [NSString stringWithUTF8String:argv[4]];
|
||||
|
||||
if ([command isEqualToString:@"apply"]) {
|
||||
int result = applyBinaryDelta(oldPath, newPath, patchFile);
|
||||
[pool drain];
|
||||
return result;
|
||||
}
|
||||
if (![command isEqualToString:@"create"]) {
|
||||
[pool drain];
|
||||
goto usage;
|
||||
}
|
||||
|
||||
NSMutableDictionary *originalTreeState = [NSMutableDictionary dictionary];
|
||||
|
||||
const char *sourcePaths[] = {[oldPath fileSystemRepresentation], 0};
|
||||
FTS *fts = fts_open((char* const*)sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||
if (!fts) {
|
||||
[pool drain];
|
||||
perror("fts_open");
|
||||
return 1;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Processing %s...", [oldPath UTF8String]);
|
||||
FTSENT *ent = 0;
|
||||
while ((ent = fts_read(fts))) {
|
||||
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D)
|
||||
continue;
|
||||
|
||||
NSString *key = pathRelativeToDirectory(oldPath, [NSString stringWithUTF8String:ent->fts_path]);
|
||||
if (![key length])
|
||||
continue;
|
||||
|
||||
NSDictionary *info = infoForFile(ent);
|
||||
[originalTreeState setObject:info forKey:key];
|
||||
}
|
||||
fts_close(fts);
|
||||
|
||||
NSString *beforeHash = hashOfTree(oldPath);
|
||||
|
||||
NSMutableDictionary *newTreeState = [NSMutableDictionary dictionary];
|
||||
for (NSString *key in originalTreeState)
|
||||
{
|
||||
[newTreeState setObject:[NSNull null] forKey:key];
|
||||
}
|
||||
|
||||
fprintf(stderr, "\nProcessing %s... ", [newPath UTF8String]);
|
||||
sourcePaths[0] = [newPath fileSystemRepresentation];
|
||||
fts = fts_open((char* const*)sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||
if (!fts) {
|
||||
[pool drain];
|
||||
perror("fts_open");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
while ((ent = fts_read(fts))) {
|
||||
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D)
|
||||
continue;
|
||||
|
||||
NSString *key = pathRelativeToDirectory(newPath, [NSString stringWithUTF8String:ent->fts_path]);
|
||||
if (![key length])
|
||||
continue;
|
||||
|
||||
NSDictionary *info = infoForFile(ent);
|
||||
NSDictionary *oldInfo = [originalTreeState objectForKey:key];
|
||||
|
||||
if ([info isEqual:oldInfo])
|
||||
[newTreeState removeObjectForKey:key];
|
||||
else
|
||||
[newTreeState setObject:info forKey:key];
|
||||
}
|
||||
fts_close(fts);
|
||||
|
||||
NSString *afterHash = hashOfTree(newPath);
|
||||
|
||||
fprintf(stderr, "\nGenerating delta... ");
|
||||
|
||||
NSString *temporaryFile = temporaryPatchFile(patchFile);
|
||||
xar_t x = xar_open([temporaryFile fileSystemRepresentation], WRITE);
|
||||
xar_opt_set(x, XAR_OPT_COMPRESSION, "bzip2");
|
||||
xar_subdoc_t attributes = xar_subdoc_new(x, "binary-delta-attributes");
|
||||
xar_subdoc_prop_set(attributes, "before-sha1", [beforeHash UTF8String]);
|
||||
xar_subdoc_prop_set(attributes, "after-sha1", [afterHash UTF8String]);
|
||||
|
||||
NSOperationQueue *deltaQueue = [[NSOperationQueue alloc] init];
|
||||
NSMutableArray *deltaOperations = [NSMutableArray array];
|
||||
|
||||
NSArray *keys = [[newTreeState allKeys] sortedArrayUsingSelector:@selector(compare:)];
|
||||
for (NSString* key in keys) {
|
||||
id value = [newTreeState valueForKey:key];
|
||||
|
||||
if ([value isEqual:[NSNull null]]) {
|
||||
xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1);
|
||||
assert(newFile);
|
||||
xar_prop_set(newFile, "delete", "true");
|
||||
continue;
|
||||
}
|
||||
|
||||
NSDictionary *originalInfo = [originalTreeState objectForKey:key];
|
||||
NSDictionary *newInfo = [newTreeState objectForKey:key];
|
||||
if (shouldSkipDeltaCompression(key, originalInfo, newInfo)) {
|
||||
NSString *path = [newPath stringByAppendingPathComponent:key];
|
||||
xar_file_t newFile = xar_add_frompath(x, 0, [key fileSystemRepresentation], [path fileSystemRepresentation]);
|
||||
assert(newFile);
|
||||
if (shouldDeleteThenExtract(key, originalInfo, newInfo))
|
||||
xar_prop_set(newFile, "delete-then-extract", "true");
|
||||
} else {
|
||||
CreateBinaryDeltaOperation *operation = [[CreateBinaryDeltaOperation alloc] initWithRelativePath:key oldTree:oldPath newTree:newPath];
|
||||
[deltaQueue addOperation:operation];
|
||||
[deltaOperations addObject:operation];
|
||||
[operation release];
|
||||
}
|
||||
}
|
||||
|
||||
[deltaQueue waitUntilAllOperationsAreFinished];
|
||||
[deltaQueue release];
|
||||
|
||||
for (CreateBinaryDeltaOperation *operation in deltaOperations) {
|
||||
NSString *resultPath = [operation resultPath];
|
||||
xar_file_t newFile = xar_add_frompath(x, 0, [[operation relativePath] fileSystemRepresentation], [resultPath fileSystemRepresentation]);
|
||||
assert(newFile);
|
||||
xar_prop_set(newFile, "binary-delta", "true");
|
||||
unlink([resultPath fileSystemRepresentation]);
|
||||
}
|
||||
|
||||
xar_close(x);
|
||||
|
||||
unlink([patchFile fileSystemRepresentation]);
|
||||
link([temporaryFile fileSystemRepresentation], [patchFile fileSystemRepresentation]);
|
||||
unlink([temporaryFile fileSystemRepresentation]);
|
||||
fprintf(stderr, "Done!\n");
|
||||
|
||||
[pool drain];
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// SUBinaryDeltaUnarchiver.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mark Rowe on 2009-06-03.
|
||||
// Copyright 2009 Mark Rowe. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SUBINARYDELTAUNARCHIVER_H
|
||||
#define SUBINARYDELTAUNARCHIVER_H
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUUnarchiver.h"
|
||||
|
||||
@interface SUBinaryDeltaUnarchiver : SUUnarchiver {
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// SUBinaryDeltaUnarchiver.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mark Rowe on 2009-06-03.
|
||||
// Copyright 2009 Mark Rowe. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUBinaryDeltaCommon.h"
|
||||
#import "SUBinaryDeltaUnarchiver.h"
|
||||
#import "SUBinaryDeltaApply.h"
|
||||
#import "SUUnarchiver_Private.h"
|
||||
#import "SUHost.h"
|
||||
#import "NTSynchronousTask.h"
|
||||
|
||||
@implementation SUBinaryDeltaUnarchiver
|
||||
|
||||
+ (BOOL)canUnarchivePath:(NSString *)path
|
||||
{
|
||||
return binaryDeltaSupported() && [[path pathExtension] isEqualToString:@"delta"];
|
||||
}
|
||||
|
||||
- (void)applyBinaryDelta
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSString *sourcePath = [[updateHost bundle] bundlePath];
|
||||
NSString *targetPath = [[archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[sourcePath lastPathComponent]];
|
||||
|
||||
int result = applyBinaryDelta(sourcePath, targetPath, archivePath);
|
||||
if (!result)
|
||||
[self performSelectorOnMainThread:@selector(notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO];
|
||||
else
|
||||
[self performSelectorOnMainThread:@selector(notifyDelegateOfFailure) withObject:nil waitUntilDone:NO];
|
||||
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
- (void)start
|
||||
{
|
||||
[NSThread detachNewThreadSelector:@selector(applyBinaryDelta) toTarget:self withObject:nil];
|
||||
}
|
||||
|
||||
+ (void)load
|
||||
{
|
||||
[self registerImplementation:self];
|
||||
}
|
||||
|
||||
@end
|
||||
+20
-20
@@ -30,37 +30,37 @@
|
||||
// Notifications:
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
extern NSString *SUUpdaterWillRestartNotification;
|
||||
extern NSString *const SUUpdaterWillRestartNotification;
|
||||
|
||||
extern NSString *SUTechnicalErrorInformationKey;
|
||||
extern NSString *const SUTechnicalErrorInformationKey;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// PList keys::
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
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 *SUFixedHTMLDisplaySizeKey;
|
||||
extern NSString *SUKeepDownloadOnFailedInstallKey;
|
||||
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 *const SUFixedHTMLDisplaySizeKey;
|
||||
extern NSString *const SUKeepDownloadOnFailedInstallKey;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Errors:
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
extern NSString *SUSparkleErrorDomain;
|
||||
extern NSString *const SUSparkleErrorDomain;
|
||||
// Appcast phase errors.
|
||||
extern OSStatus SUAppcastParseError;
|
||||
extern OSStatus SUNoUpdateError;
|
||||
|
||||
+21
-21
@@ -13,29 +13,29 @@
|
||||
#import "SUVersionComparisonProtocol.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 *SUFixedHTMLDisplaySizeKey = @"SUFixedHTMLDisplaySize";
|
||||
NSString *SUKeepDownloadOnFailedInstallKey = @"SUKeepDownloadOnFailedInstall";
|
||||
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 *const SUFixedHTMLDisplaySizeKey = @"SUFixedHTMLDisplaySize";
|
||||
NSString *const SUKeepDownloadOnFailedInstallKey = @"SUKeepDownloadOnFailedInstall";
|
||||
|
||||
NSString *SUSparkleErrorDomain = @"SUSparkleErrorDomain";
|
||||
NSString *const SUSparkleErrorDomain = @"SUSparkleErrorDomain";
|
||||
OSStatus SUAppcastParseError = 1000;
|
||||
OSStatus SUNoUpdateError = 1001;
|
||||
OSStatus SUAppcastError = 1002;
|
||||
|
||||
+37
-20
@@ -19,11 +19,11 @@
|
||||
#import <openssl/sha.h>
|
||||
|
||||
// Alex: Avoid prototype warning
|
||||
long b64decode(unsigned char* str);
|
||||
EVP_PKEY* load_dsa_key(char *key);
|
||||
static long b64decode(unsigned char* str);
|
||||
static EVP_PKEY* load_dsa_key(char *key);
|
||||
|
||||
|
||||
long b64decode(unsigned char* str)
|
||||
static long b64decode(unsigned char* str)
|
||||
{
|
||||
unsigned char *cur, *start;
|
||||
int d, dlast, phase;
|
||||
@@ -47,12 +47,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)
|
||||
@@ -83,26 +83,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;
|
||||
}
|
||||
@@ -125,13 +129,17 @@ 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.
|
||||
if ((length < 0) || (length > 0x7FFFFFFF)) { return NO; } // test before cast below
|
||||
|
||||
// We've got the signature, now get the file data.
|
||||
NSData *pathData = [NSData dataWithContentsOfFile:path];
|
||||
@@ -143,14 +151,23 @@ EVP_PKEY* load_dsa_key(char *key)
|
||||
|
||||
// Actually verify the signature on the file.
|
||||
EVP_MD_CTX ctx;
|
||||
EVP_MD_CTX_init(&ctx);
|
||||
if(EVP_VerifyInit(&ctx, EVP_dss1()) == 1) // We're using DSA keys.
|
||||
{
|
||||
EVP_VerifyUpdate(&ctx, md, SHA_DIGEST_LENGTH);
|
||||
result = (EVP_VerifyFinal(&ctx, signature, (unsigned int)length, pkey) == 1);
|
||||
|
||||
result = EVP_VerifyFinal(&ctx, signature, (unsigned int)length, pkey);
|
||||
}
|
||||
EVP_MD_CTX_cleanup(&ctx);
|
||||
|
||||
EVP_PKEY_free(pkey);
|
||||
return result;
|
||||
|
||||
// Prevent these from being collected earlier than we want (our only reference is an inner pointer).
|
||||
[pkeyData self];
|
||||
[signatureData self];
|
||||
[pathData self];
|
||||
|
||||
return result == 1;
|
||||
}
|
||||
|
||||
@end
|
||||
+21
-19
@@ -15,17 +15,12 @@
|
||||
|
||||
@implementation SUDiskImageUnarchiver
|
||||
|
||||
+ (BOOL)_canUnarchivePath:(NSString *)path
|
||||
+ (BOOL)canUnarchivePath:(NSString *)path
|
||||
{
|
||||
return [[path pathExtension] isEqualToString:@"dmg"];
|
||||
}
|
||||
|
||||
- (void)start
|
||||
{
|
||||
[NSThread detachNewThreadSelector:@selector(_extractDMG) toTarget:self withObject:nil];
|
||||
}
|
||||
|
||||
- (void)_extractDMG
|
||||
- (void)extractDMG
|
||||
{
|
||||
// GETS CALLED ON NON-MAIN THREAD!!!
|
||||
|
||||
@@ -41,14 +36,16 @@
|
||||
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);
|
||||
if (uuidString)
|
||||
{
|
||||
mountPoint = [@"/Volumes" stringByAppendingPathComponent:(NSString*)uuidString];
|
||||
CFRelease(uuidString);
|
||||
}
|
||||
CFRelease(uuid);
|
||||
}
|
||||
}
|
||||
while (noErr == FSPathMakeRefWithOptions((UInt8 *)[mountPoint fileSystemRepresentation], kFSPathMakeRefDoNotFollowLeafSymlink, &tmpRef, NULL));
|
||||
|
||||
@@ -69,7 +66,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);
|
||||
@@ -78,11 +75,11 @@
|
||||
err = FSCopyObjectSync(&srcRef, &dstRef, (CFStringRef)mountPointName, NULL, kFSFileOperationSkipSourcePermissionErrors);
|
||||
if (err != noErr) goto reportError;
|
||||
|
||||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO];
|
||||
[self performSelectorOnMainThread:@selector(notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO];
|
||||
goto finally;
|
||||
|
||||
reportError:
|
||||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfFailure) withObject:nil waitUntilDone:NO];
|
||||
[self performSelectorOnMainThread:@selector(notifyDelegateOfFailure) withObject:nil waitUntilDone:NO];
|
||||
|
||||
finally:
|
||||
if (mountedSuccessfully)
|
||||
@@ -92,9 +89,14 @@ finally:
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
- (void)start
|
||||
{
|
||||
[NSThread detachNewThreadSelector:@selector(extractDMG) toTarget:self withObject:nil];
|
||||
}
|
||||
|
||||
+ (void)load
|
||||
{
|
||||
[self _registerImplementation:self];
|
||||
[self registerImplementation:self];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -18,9 +18,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])
|
||||
SULog(@"Sparkle Error: the bundle being updated at %@ has no CFBundleIdentifier! This will cause preference read/write to not work properly.", bundle);
|
||||
@@ -96,7 +96,17 @@
|
||||
iconPath = [bundle pathForResource:[bundle objectForInfoDictionaryKey:@"CFBundleIconFile"] ofType: nil];
|
||||
NSImage *icon = [[[NSImage alloc] initWithContentsOfFile:iconPath] autorelease];
|
||||
// Use a default icon if none is defined.
|
||||
if (!icon) { icon = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(bundle == [NSBundle mainBundle] ? kGenericApplicationIcon : UTGetOSTypeFromString(CFSTR("BNDL")))]; }
|
||||
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;
|
||||
icon = [[NSWorkspace sharedWorkspace] iconForFileType:fileType];
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
@@ -111,8 +121,8 @@
|
||||
{
|
||||
ProcessSerialNumber PSN;
|
||||
GetCurrentProcess(&PSN);
|
||||
NSDictionary * processInfo = (NSDictionary *)ProcessInformationCopyDictionary(&PSN, kProcessDictionaryIncludeAllInformationMask);
|
||||
BOOL isElement = [[processInfo objectForKey:@"LSUIElement"] boolValue];
|
||||
CFDictionaryRef processInfo = ProcessInformationCopyDictionary(&PSN, kProcessDictionaryIncludeAllInformationMask);
|
||||
BOOL isElement = [[(NSDictionary *)processInfo objectForKey:@"LSUIElement"] boolValue];
|
||||
if (processInfo)
|
||||
CFRelease(processInfo);
|
||||
return isElement;
|
||||
@@ -148,18 +158,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 = ThreadSafePreferences_CopyAppValue((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
-4
@@ -15,10 +15,7 @@
|
||||
@class SUHost;
|
||||
@interface SUInstaller : NSObject { }
|
||||
+ (void)installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator;
|
||||
+ (void)_finishInstallationWithResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate;
|
||||
|
||||
+ (NSString*)updateFolder;
|
||||
+ (void)notifyDelegateOfFailure: (NSDictionary*)dict;
|
||||
+ (void)finishInstallationWithResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate;
|
||||
@end
|
||||
|
||||
@interface NSObject (SUInstallerDelegateInformalProtocol)
|
||||
|
||||
+7
-9
@@ -23,7 +23,7 @@ static NSString* sUpdateFolder = nil;
|
||||
return sUpdateFolder;
|
||||
}
|
||||
|
||||
+ (BOOL)_isAliasFolderAtPath:(NSString *)path
|
||||
+ (BOOL)isAliasFolderAtPath:(NSString *)path
|
||||
{
|
||||
FSRef fileRef;
|
||||
OSStatus err = noErr;
|
||||
@@ -95,7 +95,7 @@ static NSString* sUpdateFolder = nil;
|
||||
}
|
||||
|
||||
// Some DMGs have symlinks into /Applications! That's no good!
|
||||
if ([self _isAliasFolderAtPath:currentPath])
|
||||
if ([self isAliasFolderAtPath:currentPath])
|
||||
[dirEnum skipDescendents];
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ static NSString* sUpdateFolder = nil;
|
||||
|
||||
if (newAppDownloadPath == nil)
|
||||
{
|
||||
[self _finishInstallationWithResult:NO host:host error:[NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:[NSDictionary dictionaryWithObject:@"Couldn't find an appropriate update in the downloaded package." forKey:NSLocalizedDescriptionKey]] delegate:delegate];
|
||||
[self finishInstallationWithResult:NO host:host error:[NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:[NSDictionary dictionaryWithObject:@"Couldn't find an appropriate update in the downloaded package." forKey:NSLocalizedDescriptionKey]] delegate:delegate];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -117,7 +117,7 @@ static NSString* sUpdateFolder = nil;
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)_mdimportHost:(SUHost *)host
|
||||
+ (void)mdimportHost:(SUHost *)host
|
||||
{
|
||||
// *** GETS CALLED ON NON-MAIN THREAD!
|
||||
|
||||
@@ -143,13 +143,11 @@ static NSString* sUpdateFolder = nil;
|
||||
#define SUNotifyDictErrorKey @"SUNotifyDictError"
|
||||
#define SUNotifyDictDelegateKey @"SUNotifyDictDelegate"
|
||||
|
||||
+ (void)_finishInstallationWithResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate
|
||||
+ (void)finishInstallationWithResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate
|
||||
{
|
||||
// *** GETS CALLED ON NON-MAIN THREAD!
|
||||
|
||||
if (result == YES)
|
||||
if (result)
|
||||
{
|
||||
[self _mdimportHost:host];
|
||||
[self mdimportHost:host];
|
||||
if ([delegate respondsToSelector:@selector(installerFinishedForHost:)])
|
||||
[delegate performSelectorOnMainThread: @selector(installerFinishedForHost:) withObject: host waitUntilDone: NO];
|
||||
}
|
||||
|
||||
+8
-12
@@ -10,10 +10,6 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUConstants.h"
|
||||
|
||||
#ifndef NSAppKitVersionNumber10_4
|
||||
#define NSAppKitVersionNumber10_4 824
|
||||
#endif
|
||||
|
||||
NSString *SUPackageInstallerCommandKey = @"SUPackageInstallerCommand";
|
||||
NSString *SUPackageInstallerArgumentsKey = @"SUPackageInstallerArguments";
|
||||
NSString *SUPackageInstallerHostKey = @"SUPackageInstallerHost";
|
||||
@@ -21,12 +17,12 @@ NSString *SUPackageInstallerDelegateKey = @"SUPackageInstallerDelegate";
|
||||
|
||||
@implementation SUPackageInstaller
|
||||
|
||||
+ (void)_finishInstallationWithInfo:(NSDictionary *)info
|
||||
+ (void)finishInstallationWithInfo:(NSDictionary *)info
|
||||
{
|
||||
[self _finishInstallationWithResult:YES host:[info objectForKey:SUPackageInstallerHostKey] error:nil delegate:[info objectForKey:SUPackageInstallerDelegateKey]];
|
||||
[self finishInstallationWithResult:YES host:[info objectForKey:SUPackageInstallerHostKey] error:nil delegate:[info objectForKey:SUPackageInstallerDelegateKey]];
|
||||
}
|
||||
|
||||
+ (void)_performInstallationWithInfo:(NSDictionary *)info
|
||||
+ (void)performInstallationWithInfo:(NSDictionary *)info
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
@@ -34,7 +30,7 @@ NSString *SUPackageInstallerDelegateKey = @"SUPackageInstallerDelegate";
|
||||
[installer waitUntilExit];
|
||||
|
||||
// Known bug: if the installation fails or is canceled, Sparkle goes ahead and restarts, thinking everything is fine.
|
||||
[self performSelectorOnMainThread:@selector(_finishInstallationWithInfo:) withObject:info waitUntilDone:NO];
|
||||
[self performSelectorOnMainThread:@selector(finishInstallationWithInfo:) withObject:info waitUntilDone:NO];
|
||||
|
||||
[pool drain];
|
||||
}
|
||||
@@ -46,7 +42,7 @@ NSString *SUPackageInstallerDelegateKey = @"SUPackageInstallerDelegate";
|
||||
|
||||
if (floor(NSAppKitVersionNumber) == NSAppKitVersionNumber10_4) {
|
||||
// 10.4 uses Installer.app because the "open" command in 10.4 doesn't support -W and -n
|
||||
command = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:@"com.apple.installer"];
|
||||
command = [[NSBundle bundleWithIdentifier:@"com.apple.installer"] executablePath];
|
||||
args = [NSArray arrayWithObjects:path, nil];
|
||||
} else {
|
||||
// 10.5 and later. Run installer using the "open" command to ensure it is launched in front of current application.
|
||||
@@ -60,15 +56,15 @@ NSString *SUPackageInstallerDelegateKey = @"SUPackageInstallerDelegate";
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:command])
|
||||
{
|
||||
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingInstallerToolError userInfo:[NSDictionary dictionaryWithObject:@"Couldn't find Apple's installer tool!" forKey:NSLocalizedDescriptionKey]];
|
||||
[self _finishInstallationWithResult:NO host:host error:error delegate:delegate];
|
||||
[self finishInstallationWithResult:NO host:host error:error delegate:delegate];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:command, SUPackageInstallerCommandKey, args, SUPackageInstallerArgumentsKey, host, SUPackageInstallerHostKey, delegate, SUPackageInstallerDelegateKey, nil];
|
||||
if (synchronously)
|
||||
[self _performInstallationWithInfo:info];
|
||||
[self performInstallationWithInfo:info];
|
||||
else
|
||||
[NSThread detachNewThreadSelector:@selector(_performInstallationWithInfo:) toTarget:self withObject:info];
|
||||
[NSThread detachNewThreadSelector:@selector(performInstallationWithInfo:) toTarget:self withObject:info];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+25
-25
@@ -13,14 +13,14 @@
|
||||
|
||||
@implementation SUPipedUnarchiver
|
||||
|
||||
+ (SEL)_selectorConformingToTypeOfPath:(NSString *)path
|
||||
+ (SEL)selectorConformingToTypeOfPath:(NSString *)path
|
||||
{
|
||||
static NSDictionary *typeSelectorDictionary;
|
||||
if (!typeSelectorDictionary)
|
||||
typeSelectorDictionary = [[NSDictionary dictionaryWithObjectsAndKeys:@"_extractZIP", @".zip", @"_extractTAR", @".tar",
|
||||
@"_extractTGZ", @".tar.gz", @"_extractTGZ", @".tgz",
|
||||
@"_extractTBZ", @".tar.bz2", @"_extractTBZ", @".tbz", nil] retain];
|
||||
|
||||
typeSelectorDictionary = [[NSDictionary dictionaryWithObjectsAndKeys:@"extractZIP", @".zip", @"extractTAR", @".tar",
|
||||
@"extractTGZ", @".tar.gz", @"extractTGZ", @".tgz",
|
||||
@"extractTBZ", @".tar.bz2", @"extractTBZ", @".tbz", nil] retain];
|
||||
|
||||
NSString *lastPathComponent = [path lastPathComponent];
|
||||
NSEnumerator *typeEnumerator = [typeSelectorDictionary keyEnumerator];
|
||||
id currentType;
|
||||
@@ -35,16 +35,16 @@
|
||||
|
||||
- (void)start
|
||||
{
|
||||
[NSThread detachNewThreadSelector:[[self class] _selectorConformingToTypeOfPath:archivePath] toTarget:self withObject:nil];
|
||||
[NSThread detachNewThreadSelector:[[self class] selectorConformingToTypeOfPath:archivePath] toTarget:self withObject:nil];
|
||||
}
|
||||
|
||||
+ (BOOL)_canUnarchivePath:(NSString *)path
|
||||
+ (BOOL)canUnarchivePath:(NSString *)path
|
||||
{
|
||||
return ([self _selectorConformingToTypeOfPath:path] != nil);
|
||||
return ([self selectorConformingToTypeOfPath:path] != nil);
|
||||
}
|
||||
|
||||
// This method abstracts the types that use a command line tool piping data from stdin.
|
||||
- (void)_extractArchivePipingDataToCommand:(NSString *)command
|
||||
- (void)extractArchivePipingDataToCommand:(NSString *)command
|
||||
{
|
||||
// *** GETS CALLED ON NON-MAIN THREAD!!!
|
||||
|
||||
@@ -55,9 +55,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;
|
||||
|
||||
@@ -68,11 +68,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);
|
||||
@@ -82,18 +82,18 @@
|
||||
goto reportError;
|
||||
}
|
||||
|
||||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfExtractedLength:) withObject:[NSNumber numberWithLong:len] waitUntilDone:NO];
|
||||
[self performSelectorOnMainThread:@selector(notifyDelegateOfExtractedLength:) withObject:[NSNumber numberWithUnsignedLong:len] waitUntilDone:NO];
|
||||
}
|
||||
pclose(cmdFP);
|
||||
|
||||
if( ferror( fp ) )
|
||||
goto reportError;
|
||||
|
||||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO];
|
||||
[self performSelectorOnMainThread:@selector(notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO];
|
||||
goto finally;
|
||||
|
||||
reportError:
|
||||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfFailure) withObject:nil waitUntilDone:NO];
|
||||
[self performSelectorOnMainThread:@selector(notifyDelegateOfFailure) withObject:nil waitUntilDone:NO];
|
||||
|
||||
finally:
|
||||
if (fp)
|
||||
@@ -101,37 +101,37 @@ finally:
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
- (void)_extractTAR
|
||||
- (void)extractTAR
|
||||
{
|
||||
// *** GETS CALLED ON NON-MAIN THREAD!!!
|
||||
|
||||
return [self _extractArchivePipingDataToCommand:@"tar -xC \"$DESTINATION\""];
|
||||
return [self extractArchivePipingDataToCommand:@"tar -xC \"$DESTINATION\""];
|
||||
}
|
||||
|
||||
- (void)_extractTGZ
|
||||
- (void)extractTGZ
|
||||
{
|
||||
// *** GETS CALLED ON NON-MAIN THREAD!!!
|
||||
|
||||
return [self _extractArchivePipingDataToCommand:@"tar -zxC \"$DESTINATION\""];
|
||||
return [self extractArchivePipingDataToCommand:@"tar -zxC \"$DESTINATION\""];
|
||||
}
|
||||
|
||||
- (void)_extractTBZ
|
||||
- (void)extractTBZ
|
||||
{
|
||||
// *** GETS CALLED ON NON-MAIN THREAD!!!
|
||||
|
||||
return [self _extractArchivePipingDataToCommand:@"tar -jxC \"$DESTINATION\""];
|
||||
return [self extractArchivePipingDataToCommand:@"tar -jxC \"$DESTINATION\""];
|
||||
}
|
||||
|
||||
- (void)_extractZIP
|
||||
- (void)extractZIP
|
||||
{
|
||||
// *** GETS CALLED ON NON-MAIN THREAD!!!
|
||||
|
||||
return [self _extractArchivePipingDataToCommand:@"ditto -x -k - \"$DESTINATION\""];
|
||||
return [self extractArchivePipingDataToCommand:@"ditto -x -k - \"$DESTINATION\""];
|
||||
}
|
||||
|
||||
+ (void)load
|
||||
{
|
||||
[self _registerImplementation:self];
|
||||
[self registerImplementation:self];
|
||||
}
|
||||
|
||||
@end
|
||||
+14
-15
@@ -11,25 +11,24 @@
|
||||
#import "SUConstants.h"
|
||||
#import "SUHost.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
|
||||
|
||||
+ (void)_finishInstallationWithInfo:(NSDictionary *)info
|
||||
+ (void)finishInstallationWithInfo:(NSDictionary *)info
|
||||
{
|
||||
// *** GETS CALLED ON NON-MAIN THREAD!
|
||||
|
||||
[self _finishInstallationWithResult:[[info objectForKey:SUInstallerResultKey] boolValue] host:[info objectForKey:SUInstallerHostKey] error:[info objectForKey:SUInstallerErrorKey] delegate:[info objectForKey:SUInstallerDelegateKey]];
|
||||
[self finishInstallationWithResult:[[info objectForKey:SUInstallerResultKey] boolValue] host:[info objectForKey:SUInstallerHostKey] error:[info objectForKey:SUInstallerErrorKey] delegate:[info objectForKey:SUInstallerDelegateKey]];
|
||||
}
|
||||
|
||||
+ (void)_performInstallationWithInfo:(NSDictionary *)info
|
||||
+ (void)performInstallationWithInfo:(NSDictionary *)info
|
||||
{
|
||||
// *** GETS CALLED ON NON-MAIN THREAD!
|
||||
|
||||
@@ -52,7 +51,7 @@ NSString *SUInstallerErrorKey = @"SUInstallerError";
|
||||
[mutableInfo setObject:[NSNumber numberWithBool:result] forKey:SUInstallerResultKey];
|
||||
if (!result && error)
|
||||
[mutableInfo setObject:error forKey:SUInstallerErrorKey];
|
||||
[self performSelectorOnMainThread:@selector(_finishInstallationWithInfo:) withObject:mutableInfo waitUntilDone:NO];
|
||||
[self performSelectorOnMainThread:@selector(finishInstallationWithInfo:) withObject:mutableInfo waitUntilDone:NO];
|
||||
|
||||
[pool drain];
|
||||
}
|
||||
@@ -65,7 +64,7 @@ NSString *SUInstallerErrorKey = @"SUInstallerError";
|
||||
{
|
||||
NSString * errorMessage = [NSString stringWithFormat:@"Sparkle Updater: Possible attack in progress! Attempting to \"upgrade\" from %@ to %@. Aborting update.", [host version], [[NSBundle bundleWithPath:path] objectForInfoDictionaryKey:@"CFBundleVersion"]];
|
||||
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDowngradeError userInfo:[NSDictionary dictionaryWithObject:errorMessage forKey:NSLocalizedDescriptionKey]];
|
||||
[self _finishInstallationWithResult:NO host:host error:error delegate:delegate];
|
||||
[self finishInstallationWithResult:NO host:host error:error delegate:delegate];
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -74,9 +73,9 @@ NSString *SUInstallerErrorKey = @"SUInstallerError";
|
||||
NSString *tempName = [self temporaryNameForPath:targetPath];
|
||||
NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:path, SUInstallerPathKey, targetPath, SUInstallerTargetPathKey, tempName, SUInstallerTempNameKey, host, SUInstallerHostKey, delegate, SUInstallerDelegateKey, nil];
|
||||
if (synchronously)
|
||||
[self _performInstallationWithInfo:info];
|
||||
[self performInstallationWithInfo:info];
|
||||
else
|
||||
[NSThread detachNewThreadSelector:@selector(_performInstallationWithInfo:) toTarget:self withObject:info];
|
||||
[NSThread detachNewThreadSelector:@selector(performInstallationWithInfo:) toTarget:self withObject:info];
|
||||
}
|
||||
|
||||
@end
|
||||
+13
-10
@@ -89,9 +89,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];
|
||||
}
|
||||
|
||||
@@ -255,13 +255,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;
|
||||
@@ -427,7 +427,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
+ (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst temporaryName:(NSString *)tmp error:(NSError **)error
|
||||
{
|
||||
FSRef srcRef, dstRef, dstDirRef, movedRef, tmpDirRef;
|
||||
OSErr err;
|
||||
OSStatus err;
|
||||
BOOL hadFileAtDest = NO, didFindTrash = NO;
|
||||
NSString *tmpPath = [self _temporaryCopyNameForPath: dst didFindTrash: &didFindTrash];
|
||||
|
||||
@@ -498,9 +498,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)
|
||||
|
||||
@@ -552,8 +552,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,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
|
||||
@@ -62,9 +63,8 @@ typedef enum {
|
||||
newType = [self typeOfCharacter:character];
|
||||
if (oldType != newType || oldType == kSeparatorType) {
|
||||
// We've reached a new segment
|
||||
NSString *aPart = [[NSString alloc] initWithString:s];
|
||||
NSString *aPart = [[[NSString alloc] initWithString:s] autorelease];
|
||||
[parts addObject:aPart];
|
||||
[aPart release];
|
||||
[s setString:character];
|
||||
} else {
|
||||
// Add character to string and continue
|
||||
@@ -84,8 +84,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;
|
||||
|
||||
@@ -120,10 +120,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];
|
||||
[progressBar setUsesThreadedAnimation: YES];
|
||||
}
|
||||
|
||||
+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]];
|
||||
|
||||
|
||||
+25
-22
@@ -68,7 +68,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];
|
||||
@@ -95,28 +95,27 @@
|
||||
[statusController setMaxProgressValue:[response expectedContentLength]];
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)_humanReadableSizeFromDouble:(double)value
|
||||
- (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 setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ of %@", nil), [self _humanReadableSizeFromDouble:[statusController progressValue]], [self _humanReadableSizeFromDouble:[statusController maxProgressValue]]]];
|
||||
[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]]]];
|
||||
[statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ downloaded", nil), [self humanReadableSizeFromDouble:[statusController progressValue]]]];
|
||||
}
|
||||
|
||||
- (IBAction)cancelDownload: (id)sender
|
||||
@@ -134,27 +133,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];
|
||||
[[statusController window] makeKeyAndOrderFront: self];
|
||||
@@ -169,7 +172,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];
|
||||
|
||||
|
||||
+5
-2
@@ -9,12 +9,15 @@
|
||||
#ifndef SUUNARCHIVER_H
|
||||
#define SUUNARCHIVER_H
|
||||
|
||||
@class SUHost;
|
||||
|
||||
@interface SUUnarchiver : NSObject {
|
||||
id delegate;
|
||||
NSString *archivePath;
|
||||
SUHost *updateHost;
|
||||
}
|
||||
|
||||
+ (SUUnarchiver *)unarchiverForPath:(NSString *)path;
|
||||
+ (SUUnarchiver *)unarchiverForPath:(NSString *)path updatingHost:(SUHost *)host;
|
||||
- (void)setDelegate:delegate;
|
||||
|
||||
- (void)start;
|
||||
@@ -22,7 +25,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
|
||||
|
||||
+4
-6
@@ -17,16 +17,14 @@
|
||||
|
||||
@implementation SUUnarchiver
|
||||
|
||||
extern NSMutableArray *__unarchiverImplementations;
|
||||
|
||||
+ (SUUnarchiver *)unarchiverForPath:(NSString *)path
|
||||
+ (SUUnarchiver *)unarchiverForPath:(NSString *)path updatingHost:(SUHost *)host
|
||||
{
|
||||
NSEnumerator *implementationEnumerator = [[self _unarchiverImplementations] objectEnumerator];
|
||||
NSEnumerator *implementationEnumerator = [[self unarchiverImplementations] objectEnumerator];
|
||||
id current;
|
||||
while ((current = [implementationEnumerator nextObject]))
|
||||
{
|
||||
if ([current _canUnarchivePath:path])
|
||||
return [[[current alloc] _initWithPath:path] autorelease];
|
||||
if ([current canUnarchivePath:path])
|
||||
return [[[current alloc] initWithPath:path host:host] autorelease];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
#import "SUUnarchiver.h"
|
||||
|
||||
@interface SUUnarchiver (Private)
|
||||
+ (void)_registerImplementation:(Class)implementation;
|
||||
+ (NSArray *)_unarchiverImplementations;
|
||||
+ (BOOL)_canUnarchivePath:(NSString *)path;
|
||||
- _initWithPath:(NSString *)path;
|
||||
+ (void)registerImplementation:(Class)implementation;
|
||||
+ (NSArray *)unarchiverImplementations;
|
||||
+ (BOOL)canUnarchivePath:(NSString *)path;
|
||||
- (id)initWithPath:(NSString *)path host:(SUHost *)host;;
|
||||
|
||||
- (void)_notifyDelegateOfExtractedLength:(NSNumber *)length;
|
||||
- (void)_notifyDelegateOfSuccess;
|
||||
- (void)_notifyDelegateOfFailure;
|
||||
- (void)notifyDelegateOfExtractedLength:(NSNumber *)length;
|
||||
- (void)notifyDelegateOfSuccess;
|
||||
- (void)notifyDelegateOfFailure;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+17
-13
@@ -10,54 +10,58 @@
|
||||
|
||||
@implementation SUUnarchiver (Private)
|
||||
|
||||
- _initWithPath:(NSString *)path
|
||||
- (id)initWithPath:(NSString *)path host:(SUHost *)host
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
archivePath = [path copy];
|
||||
updateHost = [host retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[archivePath release];
|
||||
[updateHost release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
+ (BOOL)_canUnarchivePath:(NSString *)path
|
||||
+ (BOOL)canUnarchivePath:(NSString *)path
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)_notifyDelegateOfExtractedLength:(NSNumber *)length
|
||||
- (void)notifyDelegateOfExtractedLength:(NSNumber *)length
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(unarchiver:extractedLength:)])
|
||||
[delegate unarchiver:self extractedLength:[length longValue]];
|
||||
[delegate unarchiver:self extractedLength:[length unsignedLongValue]];
|
||||
}
|
||||
|
||||
- (void)_notifyDelegateOfSuccess
|
||||
- (void)notifyDelegateOfSuccess
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(unarchiverDidFinish:)])
|
||||
[delegate performSelector:@selector(unarchiverDidFinish:) withObject:self];
|
||||
}
|
||||
|
||||
- (void)_notifyDelegateOfFailure
|
||||
- (void)notifyDelegateOfFailure
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(unarchiverDidFail:)])
|
||||
[delegate performSelector:@selector(unarchiverDidFail:) withObject:self];
|
||||
}
|
||||
|
||||
static NSMutableArray *__unarchiverImplementations;
|
||||
static NSMutableArray *gUnarchiverImplementations;
|
||||
|
||||
+ (void)_registerImplementation:(Class)implementation
|
||||
+ (void)registerImplementation:(Class)implementation
|
||||
{
|
||||
if (!__unarchiverImplementations)
|
||||
__unarchiverImplementations = [[NSMutableArray alloc] init];
|
||||
[__unarchiverImplementations addObject:implementation];
|
||||
if (!gUnarchiverImplementations)
|
||||
gUnarchiverImplementations = [[NSMutableArray alloc] init];
|
||||
[gUnarchiverImplementations addObject:implementation];
|
||||
}
|
||||
|
||||
+ (NSArray *)_unarchiverImplementations
|
||||
+ (NSArray *)unarchiverImplementations
|
||||
{
|
||||
return [NSArray arrayWithArray:__unarchiverImplementations];
|
||||
return [NSArray arrayWithArray:gUnarchiverImplementations];
|
||||
}
|
||||
|
||||
@end
|
||||
+1
-1
@@ -304,7 +304,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
@@ -9,7 +9,7 @@
|
||||
#import "SUUpdateDriver.h"
|
||||
#import "SUHost.h"
|
||||
|
||||
NSString *SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
|
||||
NSString * const SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
|
||||
|
||||
@implementation SUUpdateDriver
|
||||
- initWithUpdater:(SUUpdater *)anUpdater
|
||||
|
||||
@@ -40,7 +40,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]];
|
||||
}
|
||||
|
||||
@@ -126,7 +126,6 @@
|
||||
[delegate updatePermissionPromptFinishedWithResult:([sender tag] == 1 ? SUAutomaticallyCheck : SUDoNotAutomaticallyCheck)];
|
||||
[[self window] close];
|
||||
[NSApp stopModal];
|
||||
[self autorelease];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
@interface SUUpdater : NSObject
|
||||
{
|
||||
@private
|
||||
NSTimer *checkTimer;
|
||||
SUUpdateDriver *driver;
|
||||
|
||||
|
||||
+15
-11
@@ -41,7 +41,7 @@
|
||||
#pragma mark Initialization
|
||||
|
||||
static NSMutableDictionary *sharedUpdaters = nil;
|
||||
static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObservationContext";
|
||||
static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObservationContext";
|
||||
|
||||
+ (SUUpdater *)sharedUpdater
|
||||
{
|
||||
@@ -54,7 +54,7 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
|
||||
if (bundle == nil) bundle = [NSBundle mainBundle];
|
||||
id updater = [sharedUpdaters objectForKey:[NSValue valueWithNonretainedObject:bundle]];
|
||||
if (updater == nil)
|
||||
updater = [[[self class] alloc] initForBundle:bundle];
|
||||
updater = [[[[self class] alloc] initForBundle:bundle] autorelease];
|
||||
return updater;
|
||||
}
|
||||
|
||||
@@ -63,6 +63,11 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
|
||||
{
|
||||
self = [super init];
|
||||
if (bundle == nil) bundle = [NSBundle mainBundle];
|
||||
|
||||
// Register as observer straight away to avoid exceptions on -dealloc when -unregisterAsObserver is called:
|
||||
if (self)
|
||||
[self registerAsObserver];
|
||||
|
||||
id updater = [sharedUpdaters objectForKey:[NSValue valueWithNonretainedObject:bundle]];
|
||||
if (updater)
|
||||
{
|
||||
@@ -75,7 +80,6 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
|
||||
sharedUpdaters = [[NSMutableDictionary alloc] init];
|
||||
[sharedUpdaters setObject:self forKey:[NSValue valueWithNonretainedObject:bundle]];
|
||||
host = [[SUHost alloc] initWithBundle:bundle];
|
||||
[self registerAsObserver];
|
||||
|
||||
#if !ENDANGER_USERS_WITH_INSECURE_UPDATES
|
||||
// Saving-the-developer-from-a-stupid-mistake-check:
|
||||
@@ -308,22 +312,22 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
|
||||
- (void)registerAsObserver
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDriverDidFinish:) name:SUUpdateDriverFinishedNotification object:nil];
|
||||
// No sense observing the shared NSUserDefaultsController when we're not updating the main bundle.
|
||||
if ([host bundle] != [NSBundle mainBundle]) return;
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:[@"values." stringByAppendingString:SUScheduledCheckIntervalKey] options:0 context:SUUpdaterDefaultsObservationContext];
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:[@"values." stringByAppendingString:SUEnableAutomaticChecksKey] options:0 context:SUUpdaterDefaultsObservationContext];
|
||||
}
|
||||
|
||||
- (void)unregisterAsObserver
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
// Removing self as a KVO observer if no observer was registered leads to an NSException. But we don't care.
|
||||
@try
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeyPath:[@"values." stringByAppendingString:SUScheduledCheckIntervalKey]];
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeyPath:[@"values." stringByAppendingString:SUEnableAutomaticChecksKey]];
|
||||
}
|
||||
@catch (NSException *e) { }
|
||||
@catch (NSException *e)
|
||||
{
|
||||
NSLog(@"Sparkle Error: [SUUpdater unregisterAsObserver] called, but the updater wasn't registered as an observer.");
|
||||
}
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
|
||||
@@ -455,14 +459,14 @@ 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];
|
||||
NSEnumerator *profileInfoEnumerator = [parameters objectEnumerator];
|
||||
NSDictionary *currentProfileInfo;
|
||||
while ((currentProfileInfo = [profileInfoEnumerator nextObject]))
|
||||
[parameterStrings addObject:[NSString stringWithFormat:@"%@=%@", [currentProfileInfo objectForKey:@"key"], [currentProfileInfo objectForKey:@"value"]]];
|
||||
[parameterStrings addObject:[NSString stringWithFormat:@"%@=%@", [[[currentProfileInfo objectForKey:@"key"] description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [[[currentProfileInfo objectForKey:@"value"] description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
|
||||
|
||||
NSString *separatorCharacter = @"?";
|
||||
if ([baseFeedURL query])
|
||||
@@ -470,7 +474,7 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
|
||||
NSString *appcastStringWithProfile = [NSString stringWithFormat:@"%@%@%@", [baseFeedURL absoluteString], separatorCharacter, [parameterStrings componentsJoinedByString:@"&"]];
|
||||
|
||||
// Clean it up so it's a valid URL
|
||||
return [NSURL URLWithString:[appcastStringWithProfile stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
||||
return [NSURL URLWithString:appcastStringWithProfile];
|
||||
}
|
||||
|
||||
- (void)setUpdateCheckInterval:(NSTimeInterval)updateCheckInterval
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUUIBasedUpdateDriver.h"
|
||||
|
||||
@interface SUUserInitiatedUpdateDriver : SUUIBasedUpdateDriver {
|
||||
@interface SUUserInitiatedUpdateDriver : SUUIBasedUpdateDriver
|
||||
{
|
||||
@private
|
||||
SUStatusController *checkingController;
|
||||
BOOL isCanceled;
|
||||
}
|
||||
|
||||
@@ -13,23 +13,6 @@
|
||||
|
||||
@implementation SUUserInitiatedUpdateDriver
|
||||
|
||||
- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)aHost
|
||||
{
|
||||
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 setButtonTitle:SULocalizedString(@"Cancel", nil) target:self action:@selector(cancelCheckForUpdates:) isDefault:NO];
|
||||
[checkingController showWindow:self];
|
||||
[super checkForUpdatesAtURL:URL host:aHost];
|
||||
|
||||
// For background applications, obtain focus.
|
||||
// Useful if the update check is requested from another app like System Preferences.
|
||||
if ([aHost isBackgroundApplication])
|
||||
{
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)closeCheckingWindow
|
||||
{
|
||||
if (checkingController)
|
||||
@@ -46,6 +29,23 @@
|
||||
isCanceled = YES;
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)aHost
|
||||
{
|
||||
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.0 statusText:nil];
|
||||
[checkingController setButtonTitle:SULocalizedString(@"Cancel", nil) target:self action:@selector(cancelCheckForUpdates:) isDefault:NO];
|
||||
[checkingController showWindow:self];
|
||||
[super checkForUpdatesAtURL:URL host:aHost];
|
||||
|
||||
// For background applications, obtain focus.
|
||||
// Useful if the update check is requested from another app like System Preferences.
|
||||
if ([aHost isBackgroundApplication])
|
||||
{
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)appcastDidFinishLoading:(SUAppcast *)ac
|
||||
{
|
||||
if (isCanceled)
|
||||
|
||||
@@ -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
|
||||
+15
-1
@@ -6,11 +6,25 @@
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef NSAppKitVersionNumber10_4
|
||||
#define NSAppKitVersionNumber10_4 824
|
||||
#endif
|
||||
|
||||
#ifndef NSAppKitVersionNumber10_5
|
||||
#define NSAppKitVersionNumber10_5 949
|
||||
#endif
|
||||
|
||||
#ifndef NSAppKitVersionNumber10_6
|
||||
#define NSAppKitVersionNumber10_6 1038
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
|
||||
#define SPARKLE_BUNDLE [NSBundle bundleWithIdentifier:@"org.andymatuschak.Sparkle"]
|
||||
#define SULocalizedString(key,comment) NSLocalizedStringFromTableInBundle(key, @"Sparkle", SPARKLE_BUNDLE, comment)
|
||||
#define SUAbstractFail() NSAssert2(nil, @"Can't call %@ on an instance of %@; this is an abstract method!", __PRETTY_FUNCTION__, [self class]);
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUConstants.h"
|
||||
|
||||
#endif
|
||||
+298
-299
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,501 @@
|
||||
/*-
|
||||
* Copyright 2003 - 2005 Colin Percival
|
||||
* All rights reserved
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted providing that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
__FBSDID("$FreeBSD: src/usr.bin/bsdiff/bsdiff/bsdiff.c, v 1.1 2005/08/06 01:59:05 cperciva Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define MIN(x, y) (((x)<(y)) ? (x) : (y))
|
||||
|
||||
static void split(off_t *I, off_t *V, off_t start, off_t len, off_t h)
|
||||
{
|
||||
off_t i, j, k, x, tmp, jj, kk;
|
||||
|
||||
if (len < 16) {
|
||||
for (k = start; k < start + len; k += j) {
|
||||
j = 1; x = V[I[k] + h];
|
||||
for (i = 1; k + i < start + len; i++) {
|
||||
if (V[I[k + i] + h] < x) {
|
||||
x = V[I[k + i] + h];
|
||||
j = 0;
|
||||
};
|
||||
if (V[I[k + i] + h] == x) {
|
||||
tmp = I[k + j]; I[k + j] = I[k + i]; I[k + i] = tmp;
|
||||
j++;
|
||||
};
|
||||
};
|
||||
for (i = 0; i < j; i++)
|
||||
V[I[k + i]] = k + j - 1;
|
||||
if (j == 1)
|
||||
I[k] = -1;
|
||||
};
|
||||
return;
|
||||
};
|
||||
|
||||
x = V[I[start + len/2] + h];
|
||||
jj = 0; kk = 0;
|
||||
for (i = start; i < start + len; i++) {
|
||||
if (V[I[i] + h] < x)
|
||||
jj++;
|
||||
if (V[I[i] + h] == x)
|
||||
kk++;
|
||||
};
|
||||
jj += start; kk += jj;
|
||||
|
||||
i = start; j = 0; k = 0;
|
||||
while (i < jj) {
|
||||
if (V[I[i] + h] < x) {
|
||||
i++;
|
||||
} else if (V[I[i] + h] == x) {
|
||||
tmp = I[i]; I[i] = I[jj + j]; I[jj + j] = tmp;
|
||||
j++;
|
||||
} else {
|
||||
tmp = I[i]; I[i] = I[kk + k]; I[kk + k] = tmp;
|
||||
k++;
|
||||
};
|
||||
};
|
||||
|
||||
while (jj + j < kk) {
|
||||
if (V[I[jj + j] + h] == x) {
|
||||
j++;
|
||||
} else {
|
||||
tmp = I[jj + j]; I[jj + j] = I[kk + k]; I[kk + k] = tmp;
|
||||
k++;
|
||||
};
|
||||
};
|
||||
|
||||
if (jj > start)
|
||||
split(I, V, start, jj - start, h);
|
||||
|
||||
for (i = 0; i < kk - jj; i++)
|
||||
V[I[jj + i]] = kk - 1;
|
||||
if (jj == kk - 1)
|
||||
I[jj] = -1;
|
||||
|
||||
if (start + len > kk)
|
||||
split(I, V, kk, start + len - kk, h);
|
||||
}
|
||||
|
||||
/* qsufsort(I, V, old, oldsize)
|
||||
*
|
||||
* Computes the suffix sort of the string at 'old' and stores the resulting
|
||||
* indices in 'I', using 'V' as a temporary array for the computation. */
|
||||
static void qsufsort(off_t *I, off_t *V, u_char *old, off_t oldsize)
|
||||
{
|
||||
off_t buckets[256];
|
||||
off_t i, h, len;
|
||||
|
||||
/* count number of each byte */
|
||||
for (i = 0; i < 256; i++)
|
||||
buckets[i] = 0;
|
||||
for (i = 0; i < oldsize; i++)
|
||||
buckets[old[i]]++;
|
||||
/* make buckets cumulative */
|
||||
for (i = 1; i < 256; i++)
|
||||
buckets[i] += buckets[i - 1];
|
||||
/* shift right by one */
|
||||
for (i = 255; i > 0; i--)
|
||||
buckets[i] = buckets[i - 1];
|
||||
buckets[0] = 0;
|
||||
/* at this point, buckets[c] is the number of bytes in the old file with
|
||||
* value less than c. */
|
||||
|
||||
/* set up the sort order of the suffixes based solely on the first
|
||||
* character */
|
||||
for (i = 0; i < oldsize; i++)
|
||||
I[++buckets[old[i]]] = i;
|
||||
I[0] = oldsize;
|
||||
/* ? */
|
||||
for (i = 0; i < oldsize; i++)
|
||||
V[i] = buckets[old[i]];
|
||||
V[oldsize] = 0;
|
||||
/* forward any entries in the ordering which have the same initial
|
||||
* character */
|
||||
for (i = 1; i < 256; i++) {
|
||||
if (buckets[i] == buckets[i - 1] + 1)
|
||||
I[buckets[i]] = -1;
|
||||
}
|
||||
I[0] = -1;
|
||||
|
||||
for (h = 1; I[0] != -(oldsize + 1); h += h) {
|
||||
len = 0;
|
||||
for (i = 0; i < oldsize + 1;) {
|
||||
if (I[i] < 0) {
|
||||
len -= I[i];
|
||||
i -= I[i];
|
||||
} else {
|
||||
if (len)
|
||||
I[i - len] = -len;
|
||||
len = V[I[i]] + 1 - i;
|
||||
split(I, V, i, len, h);
|
||||
i += len;
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
if (len)
|
||||
I[i - len] = -len;
|
||||
};
|
||||
|
||||
for (i = 0; i < oldsize + 1; i++) I[V[i]] = i;
|
||||
}
|
||||
|
||||
/* matchlen(old, oldsize, new, newsize)
|
||||
*
|
||||
* Returns the length of the longest common prefix between 'old' and 'new'. */
|
||||
static off_t matchlen(u_char *old, off_t oldsize, u_char *new, off_t newsize)
|
||||
{
|
||||
off_t i;
|
||||
|
||||
for (i = 0; (i < oldsize) && (i < newsize); i++)
|
||||
{
|
||||
if (old[i] != new[i])
|
||||
break;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/* search(I, old, oldsize, new, newsize, st, en, pos)
|
||||
*
|
||||
* Searches for the longest prefix of 'new' that occurs in 'old', stores its
|
||||
* offset in '*pos', and returns its length. 'I' should be the suffix sort of
|
||||
* 'old', and 'st' and 'en' are the lowest and highest indices in the suffix
|
||||
* sort to consider. If you're searching all suffixes, 'st = 0' and 'en =
|
||||
* oldsize - 1'. */
|
||||
static off_t search(off_t *I, u_char *old, off_t oldsize,
|
||||
u_char *new, off_t newsize, off_t st, off_t en, off_t *pos)
|
||||
{
|
||||
off_t x, y;
|
||||
|
||||
if (en - st < 2) {
|
||||
x = matchlen(old + I[st], oldsize - I[st], new, newsize);
|
||||
y = matchlen(old + I[en], oldsize - I[en], new, newsize);
|
||||
|
||||
if (x > y) {
|
||||
*pos = I[st];
|
||||
return x;
|
||||
} else {
|
||||
*pos = I[en];
|
||||
return y;
|
||||
}
|
||||
}
|
||||
|
||||
x = st + (en - st)/2;
|
||||
if (memcmp(old + I[x], new, MIN(oldsize - I[x], newsize)) < 0) {
|
||||
return search(I, old, oldsize, new, newsize, x, en, pos);
|
||||
} else {
|
||||
return search(I, old, oldsize, new, newsize, st, x, pos);
|
||||
};
|
||||
}
|
||||
|
||||
/* offtout(x, buf)
|
||||
*
|
||||
* Writes the off_t 'x' portably to the array 'buf'. */
|
||||
static void offtout(off_t x, u_char *buf)
|
||||
{
|
||||
off_t y;
|
||||
|
||||
if (x < 0)
|
||||
y = -x;
|
||||
else
|
||||
y = x;
|
||||
|
||||
buf[0] = y % 256;
|
||||
y -= buf[0];
|
||||
y = y/256; buf[1] = y%256; y -= buf[1];
|
||||
y = y/256; buf[2] = y%256; y -= buf[2];
|
||||
y = y/256; buf[3] = y%256; y -= buf[3];
|
||||
y = y/256; buf[4] = y%256; y -= buf[4];
|
||||
y = y/256; buf[5] = y%256; y -= buf[5];
|
||||
y = y/256; buf[6] = y%256; y -= buf[6];
|
||||
y = y/256; buf[7] = y%256;
|
||||
|
||||
if (x < 0)
|
||||
buf[7] |= 0x80;
|
||||
}
|
||||
|
||||
int bsdiff(int argc, char *argv[]); // Added by AMM: suppresses a warning about the following not having a prototype.
|
||||
|
||||
int bsdiff(int argc, char *argv[])
|
||||
{
|
||||
int fd;
|
||||
u_char *old,*new; /* contents of old, new files */
|
||||
off_t oldsize, newsize; /* length of old, new files */
|
||||
off_t *I,*V; /* arrays used for suffix sort; I is ordering */
|
||||
off_t scan; /* position of current match in old file */
|
||||
off_t pos; /* position of current match in new file */
|
||||
off_t len; /* length of current match */
|
||||
off_t lastscan; /* position of previous match in old file */
|
||||
off_t lastpos; /* position of previous match in new file */
|
||||
off_t lastoffset; /* lastpos - lastscan */
|
||||
off_t oldscore, scsc; /* temp variables in match search */
|
||||
off_t s, Sf, lenf, Sb, lenb; /* temp vars in match extension */
|
||||
off_t overlap, Ss, lens;
|
||||
off_t i;
|
||||
off_t dblen, eblen; /* length of diff, extra sections */
|
||||
u_char *db,*eb; /* contents of diff, extra sections */
|
||||
u_char buf[8];
|
||||
u_char header[32];
|
||||
FILE * pf;
|
||||
|
||||
if (argc != 4)
|
||||
errx(1,"usage: %s oldfile newfile patchfile\n", argv[0]);
|
||||
|
||||
/* Allocate oldsize + 1 bytes instead of oldsize bytes to ensure
|
||||
that we never try to malloc(0) and get a NULL pointer */
|
||||
if (((fd = open(argv[1], O_RDONLY, 0)) < 0) ||
|
||||
((oldsize = lseek(fd, 0, SEEK_END)) == -1) ||
|
||||
((old = malloc(oldsize + 1)) == NULL) ||
|
||||
(lseek(fd, 0, SEEK_SET) != 0) ||
|
||||
(read(fd, old, oldsize) != oldsize) ||
|
||||
(close(fd) == -1))
|
||||
err(1,"%s", argv[1]);
|
||||
|
||||
if (((I = malloc((oldsize + 1) * sizeof(off_t))) == NULL) ||
|
||||
((V = malloc((oldsize + 1) * sizeof(off_t))) == NULL))
|
||||
err(1, NULL);
|
||||
|
||||
/* Do a suffix sort on the old file. */
|
||||
qsufsort(I, V, old, oldsize);
|
||||
|
||||
free(V);
|
||||
|
||||
/* Allocate newsize + 1 bytes instead of newsize bytes to ensure
|
||||
that we never try to malloc(0) and get a NULL pointer */
|
||||
if (((fd = open(argv[2], O_RDONLY, 0)) < 0) ||
|
||||
((newsize = lseek(fd, 0, SEEK_END)) == -1) ||
|
||||
((new = malloc(newsize + 1)) == NULL) ||
|
||||
(lseek(fd, 0, SEEK_SET) != 0) ||
|
||||
(read(fd, new, newsize) != newsize) ||
|
||||
(close(fd) == -1))
|
||||
err(1,"%s", argv[2]);
|
||||
|
||||
if (((db = malloc(newsize + 1)) == NULL) ||
|
||||
((eb = malloc(newsize + 1)) == NULL))
|
||||
err(1, NULL);
|
||||
dblen = 0;
|
||||
eblen = 0;
|
||||
|
||||
/* Create the patch file */
|
||||
if ((pf = fopen(argv[3], "w")) == NULL)
|
||||
err(1, "%s", argv[3]);
|
||||
|
||||
/* Header is
|
||||
0 8 "BSDIFN40"
|
||||
8 8 length of ctrl block
|
||||
16 8 length of diff block
|
||||
24 8 length of new file */
|
||||
/* File is
|
||||
0 32 Header
|
||||
32 ?? ctrl block
|
||||
?? ?? diff block
|
||||
?? ?? extra block */
|
||||
memcpy(header, "BSDIFN40", 8);
|
||||
offtout(0, header + 8);
|
||||
offtout(0, header + 16);
|
||||
offtout(newsize, header + 24);
|
||||
if (fwrite(header, 32, 1, pf) != 1)
|
||||
err(1, "fwrite(%s)", argv[3]);
|
||||
|
||||
/* Compute the differences, writing ctrl as we go */
|
||||
scan = 0;
|
||||
len = 0;
|
||||
lastscan = 0;
|
||||
lastpos = 0;
|
||||
lastoffset = 0;
|
||||
while (scan < newsize) {
|
||||
oldscore = 0;
|
||||
|
||||
for (scsc = scan += len; scan < newsize; scan++) {
|
||||
/* 'oldscore' is the number of characters that match between the
|
||||
* substrings 'old[lastoffset + scan:lastoffset + scsc]' and
|
||||
* 'new[scan:scsc]'. */
|
||||
len = search(I, old, oldsize, new + scan, newsize - scan,
|
||||
0, oldsize, &pos);
|
||||
|
||||
/* If this match extends further than the last one, add any new
|
||||
* matching characters to 'oldscore'. */
|
||||
for (; scsc < scan + len; scsc++) {
|
||||
if ((scsc + lastoffset < oldsize) &&
|
||||
(old[scsc + lastoffset] == new[scsc]))
|
||||
oldscore++;
|
||||
}
|
||||
|
||||
/* Choose this as our match if it contains more than eight
|
||||
* characters that would be wrong if matched with a forward
|
||||
* extension of the previous match instead. */
|
||||
if (((len == oldscore) && (len != 0)) ||
|
||||
(len > oldscore + 8))
|
||||
break;
|
||||
|
||||
/* Since we're advancing 'scan' by 1, remove the character under it
|
||||
* from 'oldscore' if it matches. */
|
||||
if ((scan + lastoffset < oldsize) &&
|
||||
(old[scan + lastoffset] == new[scan]))
|
||||
oldscore--;
|
||||
}
|
||||
|
||||
/* Skip this section if we found an exact match that would be
|
||||
* better serviced by a forward extension of the previous match. */
|
||||
if ((len != oldscore) || (scan == newsize)) {
|
||||
/* Figure out how far forward the previous match should be
|
||||
* extended... */
|
||||
s = 0;
|
||||
Sf = 0;
|
||||
lenf = 0;
|
||||
for (i = 0; (lastscan + i < scan) && (lastpos + i < oldsize);) {
|
||||
if (old[lastpos + i] == new[lastscan + i])
|
||||
s++;
|
||||
i++;
|
||||
if (s * 2 - i > Sf * 2 - lenf) {
|
||||
Sf = s;
|
||||
lenf = i;
|
||||
}
|
||||
}
|
||||
|
||||
/* ... and how far backwards the next match should be extended. */
|
||||
lenb = 0;
|
||||
if (scan < newsize) {
|
||||
s = 0;
|
||||
Sb = 0;
|
||||
for (i = 1; (scan >= lastscan + i) && (pos >= i); i++) {
|
||||
if (old[pos - i] == new[scan - i])
|
||||
s++;
|
||||
if (s * 2 - i > Sb * 2 - lenb) {
|
||||
Sb = s;
|
||||
lenb = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If there is an overlap between the extensions, find the best
|
||||
* dividing point in the middle and reset 'lenf' and 'lenb'
|
||||
* accordingly. */
|
||||
if (lastscan + lenf > scan - lenb) {
|
||||
overlap = (lastscan + lenf) - (scan - lenb);
|
||||
s = 0;
|
||||
Ss = 0;
|
||||
lens = 0;
|
||||
for (i = 0; i < overlap; i++) {
|
||||
if (new[lastscan + lenf - overlap + i] ==
|
||||
old[lastpos + lenf - overlap + i])
|
||||
s++;
|
||||
if (new[scan - lenb + i] == old[pos - lenb + i])
|
||||
s--;
|
||||
if (s > Ss) {
|
||||
Ss = s;
|
||||
lens = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
lenf += lens - overlap;
|
||||
lenb -= lens;
|
||||
}
|
||||
|
||||
/* Write the diff data for the last match to the diff section... */
|
||||
for (i = 0; i < lenf; i++)
|
||||
db[dblen + i] = new[lastscan + i] - old[lastpos + i];
|
||||
/* ... and, if there's a gap between the extensions just
|
||||
* calculated, write the data in that gap to the extra section. */
|
||||
for (i = 0; i< (scan - lenb) - (lastscan + lenf); i++)
|
||||
eb[eblen + i] = new[lastscan + lenf + i];
|
||||
|
||||
/* Update the diff and extra section lengths accordingly. */
|
||||
dblen += lenf;
|
||||
eblen += (scan - lenb) - (lastscan + lenf);
|
||||
|
||||
/* Write the following triple of integers to the control section:
|
||||
* - length of the diff
|
||||
* - length of the extra section
|
||||
* - offset between the end of the diff and the start of the next
|
||||
* diff, in the old file
|
||||
*/
|
||||
offtout(lenf, buf);
|
||||
if (fwrite(buf, 8, 1, pf) != 1)
|
||||
errx(1, "fwrite");
|
||||
|
||||
offtout((scan - lenb) - (lastscan + lenf), buf);
|
||||
if (fwrite(buf, 8, 1, pf) != 1)
|
||||
err(1, "fwrite");
|
||||
|
||||
offtout((pos - lenb) - (lastpos + lenf), buf);
|
||||
if (fwrite(buf, 8, 1, pf) != 1)
|
||||
err(1, "fwrite");
|
||||
|
||||
/* Update the variables describing the last match. Note that
|
||||
* 'lastscan' is set to the start of the current match _after_ the
|
||||
* backwards extension; the data in that extension will be written
|
||||
* in the next pass. */
|
||||
lastscan = scan - lenb;
|
||||
lastpos = pos - lenb;
|
||||
lastoffset = pos - scan;
|
||||
}
|
||||
}
|
||||
|
||||
/* Compute size of compressed ctrl data */
|
||||
if ((len = ftello(pf)) == -1)
|
||||
err(1, "ftello");
|
||||
offtout(len - 32, header + 8);
|
||||
|
||||
/* Write diff data */
|
||||
if (dblen && fwrite(db, dblen, 1, pf) != 1)
|
||||
err(1, "fwrite");
|
||||
|
||||
/* Compute size of compressed diff data */
|
||||
if ((newsize = ftello(pf)) == -1)
|
||||
err(1, "ftello");
|
||||
offtout(newsize - len, header + 16);
|
||||
|
||||
/* Write extra data */
|
||||
if (eblen && fwrite(eb, eblen, 1, pf) != 1)
|
||||
err(1, "fwrite");
|
||||
|
||||
/* Seek to the beginning, write the header, and close the file */
|
||||
if (fseeko(pf, 0, SEEK_SET))
|
||||
err(1, "fseeko");
|
||||
if (fwrite(header, 32, 1, pf) != 1)
|
||||
err(1, "fwrite(%s)", argv[3]);
|
||||
if (fclose(pf))
|
||||
err(1, "fclose");
|
||||
|
||||
/* Free the memory we used */
|
||||
free(db);
|
||||
free(eb);
|
||||
free(I);
|
||||
free(old);
|
||||
free(new);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
/*-
|
||||
* Copyright 2003-2005 Colin Percival
|
||||
* All rights reserved
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted providing that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
__FBSDID("$FreeBSD: src/usr.bin/bsdiff/bspatch/bspatch.c,v 1.1 2005/08/06 01:59:06 cperciva Exp $");
|
||||
#endif
|
||||
|
||||
#include <bspatch.h>
|
||||
#include <bzlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/* Compatibility layer for reading either the old BSDIFF40 or the new BSDIFN40
|
||||
patch formats: */
|
||||
|
||||
typedef void* stream_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
stream_t (*open)(FILE*);
|
||||
void (*close)(stream_t);
|
||||
int (*read)(stream_t, void*, int);
|
||||
} io_funcs_t;
|
||||
|
||||
static stream_t BSDIFF40_open(FILE *f)
|
||||
{
|
||||
int bzerr;
|
||||
BZFILE *s;
|
||||
if ((s = BZ2_bzReadOpen(&bzerr, f, 0, 0, NULL, 0)) == NULL)
|
||||
errx(1, "BZ2_bzReadOpen, bz2err = %d", bzerr);
|
||||
return s;
|
||||
}
|
||||
|
||||
static void BSDIFF40_close(stream_t s)
|
||||
{
|
||||
int bzerr;
|
||||
BZ2_bzReadClose(&bzerr, (BZFILE*)s);
|
||||
}
|
||||
|
||||
static int BSDIFF40_read(stream_t s, void *buf, int len)
|
||||
{
|
||||
int bzerr, lenread;
|
||||
lenread = BZ2_bzRead(&bzerr, (BZFILE*)s, buf, len);
|
||||
if (bzerr != BZ_OK && bzerr != BZ_STREAM_END)
|
||||
errx(1, "Corrupt patch\n");
|
||||
return lenread;
|
||||
}
|
||||
|
||||
static io_funcs_t BSDIFF40_funcs = {
|
||||
BSDIFF40_open,
|
||||
BSDIFF40_close,
|
||||
BSDIFF40_read
|
||||
};
|
||||
|
||||
|
||||
static stream_t BSDIFN40_open(FILE *f)
|
||||
{
|
||||
return f;
|
||||
}
|
||||
|
||||
static void BSDIFN40_close(stream_t s)
|
||||
{
|
||||
}
|
||||
|
||||
static int BSDIFN40_read(stream_t s, void *buf, int len)
|
||||
{
|
||||
return fread(buf, 1, len, (FILE*)s);
|
||||
}
|
||||
|
||||
static io_funcs_t BSDIFN40_funcs = {
|
||||
BSDIFN40_open,
|
||||
BSDIFN40_close,
|
||||
BSDIFN40_read
|
||||
};
|
||||
|
||||
|
||||
#ifndef u_char
|
||||
typedef unsigned char u_char;
|
||||
#endif
|
||||
|
||||
static off_t offtin(u_char *buf)
|
||||
{
|
||||
off_t y;
|
||||
|
||||
y=buf[7]&0x7F;
|
||||
y=y*256;y+=buf[6];
|
||||
y=y*256;y+=buf[5];
|
||||
y=y*256;y+=buf[4];
|
||||
y=y*256;y+=buf[3];
|
||||
y=y*256;y+=buf[2];
|
||||
y=y*256;y+=buf[1];
|
||||
y=y*256;y+=buf[0];
|
||||
|
||||
if(buf[7]&0x80) y=-y;
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
int bspatch(int argc,char * argv[])
|
||||
{
|
||||
FILE * f, * cpf, * dpf, * epf;
|
||||
stream_t cstream, dstream, estream;
|
||||
int fd;
|
||||
ssize_t oldsize,newsize;
|
||||
ssize_t bzctrllen,bzdatalen;
|
||||
u_char header[32],buf[8];
|
||||
u_char *old, *new;
|
||||
off_t oldpos,newpos;
|
||||
off_t ctrl[3];
|
||||
off_t lenread;
|
||||
off_t i;
|
||||
io_funcs_t * io;
|
||||
|
||||
if(argc!=4) errx(1,"usage: %s oldfile newfile patchfile\n",argv[0]);
|
||||
|
||||
/* Open patch file */
|
||||
if ((f = fopen(argv[3], "r")) == NULL)
|
||||
err(1, "fopen(%s)", argv[3]);
|
||||
|
||||
/*
|
||||
File format:
|
||||
0 8 "BSDIFF40" (bzip2) or "BSDIFN40" (raw)
|
||||
8 8 X
|
||||
16 8 Y
|
||||
24 8 sizeof(newfile)
|
||||
32 X bzip2(control block)
|
||||
32+X Y bzip2(diff block)
|
||||
32+X+Y ??? bzip2(extra block)
|
||||
with control block a set of triples (x,y,z) meaning "add x bytes
|
||||
from oldfile to x bytes from the diff block; copy y bytes from the
|
||||
extra block; seek forwards in oldfile by z bytes".
|
||||
*/
|
||||
|
||||
/* Read header */
|
||||
if (fread(header, 1, 32, f) < 32) {
|
||||
if (feof(f))
|
||||
errx(1, "Corrupt patch\n");
|
||||
err(1, "fread(%s)", argv[3]);
|
||||
}
|
||||
|
||||
/* Check for appropriate magic */
|
||||
if (memcmp(header, "BSDIFF40", 8) == 0)
|
||||
io = &BSDIFF40_funcs;
|
||||
else if (memcmp(header, "BSDIFN40", 8) == 0)
|
||||
io = &BSDIFN40_funcs;
|
||||
else
|
||||
errx(1, "Corrupt patch\n");
|
||||
|
||||
/* Read lengths from header */
|
||||
bzctrllen=offtin(header+8);
|
||||
bzdatalen=offtin(header+16);
|
||||
newsize=offtin(header+24);
|
||||
if((bzctrllen<0) || (bzdatalen<0) || (newsize<0))
|
||||
errx(1,"Corrupt patch\n");
|
||||
|
||||
/* Close patch file and re-open it via libbzip2 at the right places */
|
||||
if (fclose(f))
|
||||
err(1, "fclose(%s)", argv[3]);
|
||||
if ((cpf = fopen(argv[3], "r")) == NULL)
|
||||
err(1, "fopen(%s)", argv[3]);
|
||||
if (fseeko(cpf, 32, SEEK_SET))
|
||||
err(1, "fseeko(%s, %lld)", argv[3],
|
||||
(long long)32);
|
||||
cstream = io->open(cpf);
|
||||
if ((dpf = fopen(argv[3], "r")) == NULL)
|
||||
err(1, "fopen(%s)", argv[3]);
|
||||
if (fseeko(dpf, 32 + bzctrllen, SEEK_SET))
|
||||
err(1, "fseeko(%s, %lld)", argv[3],
|
||||
(long long)(32 + bzctrllen));
|
||||
dstream = io->open(dpf);
|
||||
if ((epf = fopen(argv[3], "r")) == NULL)
|
||||
err(1, "fopen(%s)", argv[3]);
|
||||
if (fseeko(epf, 32 + bzctrllen + bzdatalen, SEEK_SET))
|
||||
err(1, "fseeko(%s, %lld)", argv[3],
|
||||
(long long)(32 + bzctrllen + bzdatalen));
|
||||
estream = io->open(epf);
|
||||
|
||||
if(((fd=open(argv[1],O_RDONLY,0))<0) ||
|
||||
((oldsize=lseek(fd,0,SEEK_END))==-1) ||
|
||||
((old=malloc(oldsize+1))==NULL) ||
|
||||
(lseek(fd,0,SEEK_SET)!=0) ||
|
||||
(read(fd,old,oldsize)!=oldsize) ||
|
||||
(close(fd)==-1)) err(1,"%s",argv[1]);
|
||||
if((new=malloc(newsize+1))==NULL) err(1,NULL);
|
||||
|
||||
oldpos=0;newpos=0;
|
||||
while(newpos<newsize) {
|
||||
/* Read control data */
|
||||
for(i=0;i<=2;i++) {
|
||||
lenread = io->read(cstream, buf, 8);
|
||||
if (lenread < 8)
|
||||
errx(1, "Corrupt patch\n");
|
||||
ctrl[i]=offtin(buf);
|
||||
};
|
||||
|
||||
/* Sanity-check */
|
||||
if(newpos+ctrl[0]>newsize)
|
||||
errx(1,"Corrupt patch\n");
|
||||
|
||||
/* Read diff string */
|
||||
lenread = io->read(dstream, new + newpos, ctrl[0]);
|
||||
if (lenread < ctrl[0])
|
||||
errx(1, "Corrupt patch\n");
|
||||
|
||||
/* Add old data to diff string */
|
||||
for(i=0;i<ctrl[0];i++)
|
||||
if((oldpos+i>=0) && (oldpos+i<oldsize))
|
||||
new[newpos+i]+=old[oldpos+i];
|
||||
|
||||
/* Adjust pointers */
|
||||
newpos+=ctrl[0];
|
||||
oldpos+=ctrl[0];
|
||||
|
||||
/* Sanity-check */
|
||||
if(newpos+ctrl[1]>newsize)
|
||||
errx(1,"Corrupt patch\n");
|
||||
|
||||
/* Read extra string */
|
||||
lenread = io->read(estream, new + newpos, ctrl[1]);
|
||||
if (lenread < ctrl[1])
|
||||
errx(1, "Corrupt patch\n");
|
||||
|
||||
/* Adjust pointers */
|
||||
newpos+=ctrl[1];
|
||||
oldpos+=ctrl[2];
|
||||
};
|
||||
|
||||
/* Clean up the bzip2 reads */
|
||||
io->close(cstream);
|
||||
io->close(dstream);
|
||||
io->close(estream);
|
||||
if (fclose(cpf) || fclose(dpf) || fclose(epf))
|
||||
err(1, "fclose(%s)", argv[3]);
|
||||
|
||||
/* Write the new file */
|
||||
if(((fd=open(argv[2],O_CREAT|O_TRUNC|O_WRONLY,0666))<0) ||
|
||||
(write(fd,new,newsize)!=newsize) || (close(fd)==-1))
|
||||
err(1,"%s",argv[2]);
|
||||
|
||||
free(new);
|
||||
free(old);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* bspatch.h
|
||||
* Sparkle
|
||||
*
|
||||
* Created by Andy Matuschak on 1/11/10.
|
||||
* Copyright 2010 Andy Matuschak. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
// So that we can use this method in SUBinaryDeltaApply.m.
|
||||
// Silences the GCC warning that the prototype doesn't exist.
|
||||
int bspatch(int argc, char * argv[]);
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3
-2
@@ -2,12 +2,13 @@
|
||||
["dsaparam.pem", "dsa_priv.pem", "dsa_pub.pem"].each do |file|
|
||||
if File.exist? file
|
||||
puts "There's already a #{file} here! Move it aside or be more careful!"
|
||||
exit
|
||||
end
|
||||
end
|
||||
`openssl dsaparam 2048 < /dev/urandom > dsaparam.pem`
|
||||
`openssl dsaparam 1024 < /dev/urandom > dsaparam.pem`
|
||||
`openssl gendsa dsaparam.pem -out dsa_priv.pem`
|
||||
`openssl dsa -in dsa_priv.pem -pubout -out dsa_pub.pem`
|
||||
`rm dsaparam.pem`
|
||||
puts "\nGenerated private and public keys: dsa_priv.pem and dsa_pub.pem.\n
|
||||
BACK UP YOUR PRIVATE KEY AND KEEP IT SAFE!\n
|
||||
If you lose it, your users will be unable to upgrade!\n"
|
||||
If you lose it, your users will be unable to upgrade!\n"
|
||||
@@ -2,6 +2,7 @@
|
||||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1050</int>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
<string key="IBDocument.SystemVersion">10C540</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">759</string>
|
||||
<string key="IBDocument.AppKitVersion">1038.25</string>
|
||||
@@ -26,6 +27,21 @@
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>com.apple.WebKitIBPlugin</string>
|
||||
=======
|
||||
<string key="IBDocument.SystemVersion">10D573</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">785</string>
|
||||
<string key="IBDocument.AppKitVersion">1038.29</string>
|
||||
<string key="IBDocument.HIToolboxVersion">460.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="NS.object.0">785</string>
|
||||
</object>
|
||||
<array class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<integer value="6"/>
|
||||
<integer value="39"/>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
@@ -51,10 +67,19 @@
|
||||
<object class="NSWindowTemplate" id="4143833">
|
||||
<int key="NSWindowStyleMask">15</int>
|
||||
<int key="NSWindowBacking">2</int>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
<string key="NSWindowRect">{{248, 468}, {586, 370}}</string>
|
||||
<int key="NSWTFlags">-260571136</int>
|
||||
<string key="NSWindowTitle">Hugbúnaðaruppfærsla</string>
|
||||
<string key="NSWindowClass">NSWindow</string>
|
||||
=======
|
||||
<string key="NSWindowRect">{{83, 472}, {471, 188}}</string>
|
||||
<int key="NSWTFlags">1886912512</int>
|
||||
<string key="NSWindowTitle"/>
|
||||
<object class="NSMutableString" key="NSWindowClass">
|
||||
<characters key="NS.bytes">NSWindow</characters>
|
||||
</object>
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
<object class="NSMutableString" key="NSViewClass">
|
||||
<characters key="NS.bytes">View</characters>
|
||||
</object>
|
||||
@@ -63,6 +88,7 @@
|
||||
<object class="NSView" key="NSWindowView" id="515227806">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSImageView" id="562603772">
|
||||
@@ -78,10 +104,37 @@
|
||||
<string>NSFilenamesPboardType</string>
|
||||
<string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
|
||||
<string>NeXT TIFF v4.0 pasteboard type</string>
|
||||
=======
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="NSButton" id="109751002">
|
||||
<reference key="NSNextResponder" ref="590688073"/>
|
||||
<int key="NSvFlags">257</int>
|
||||
<string key="NSFrame">{{232, 12}, {225, 32}}</string>
|
||||
<reference key="NSSuperview" ref="590688073"/>
|
||||
<int key="NSTag">1</int>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="1020387491">
|
||||
<int key="NSCellFlags">-2080244224</int>
|
||||
<int key="NSCellFlags2">134217728</int>
|
||||
<string key="NSContents">Comprobar automáticamente</string>
|
||||
<object class="NSFont" key="NSSupport" id="755404857">
|
||||
<string key="NSName">LucidaGrande</string>
|
||||
<double key="NSSize">13</double>
|
||||
<int key="NSfFlags">1044</int>
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
</object>
|
||||
</object>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
<string key="NSFrame">{{24, 291}, {64, 64}}</string>
|
||||
<reference key="NSSuperview" ref="515227806"/>
|
||||
=======
|
||||
</object>
|
||||
<object class="NSButton" id="78347976">
|
||||
<reference key="NSNextResponder" ref="590688073"/>
|
||||
<int key="NSvFlags">257</int>
|
||||
<string key="NSFrame">{{101, 12}, {131, 32}}</string>
|
||||
<reference key="NSSuperview" ref="590688073"/>
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSImageCell" key="NSCell" id="392865046">
|
||||
<int key="NSCellFlags">130560</int>
|
||||
@@ -100,8 +153,13 @@
|
||||
<object class="NSTextField" id="695267457">
|
||||
<reference key="NSNextResponder" ref="515227806"/>
|
||||
<int key="NSvFlags">264</int>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
<string key="NSFrame">{{106, 338}, {443, 17}}</string>
|
||||
<reference key="NSSuperview" ref="515227806"/>
|
||||
=======
|
||||
<string key="NSFrame">{{104, 134}, {289, 34}}</string>
|
||||
<reference key="NSSuperview" ref="590688073"/>
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="966434407">
|
||||
<int key="NSCellFlags">67239424</int>
|
||||
@@ -133,18 +191,32 @@
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
<object class="NSTextField" id="928673172">
|
||||
<reference key="NSNextResponder" ref="515227806"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{106, 277}, {443, 17}}</string>
|
||||
<reference key="NSSuperview" ref="515227806"/>
|
||||
=======
|
||||
<object class="NSTextField" id="103292136">
|
||||
<reference key="NSNextResponder" ref="590688073"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<string key="NSFrame">{{104, 78}, {348, 42}}</string>
|
||||
<reference key="NSSuperview" ref="590688073"/>
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="413774002">
|
||||
<int key="NSCellFlags">67239424</int>
|
||||
<int key="NSCellFlags2">272629760</int>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
<string key="NSContents">Útgáfupunktar:</string>
|
||||
<object class="NSFont" key="NSSupport">
|
||||
<string key="NSName">LucidaGrande-Bold</string>
|
||||
=======
|
||||
<string type="base64-UTF8" key="NSContents">Tk8gTE9DQUxJWkFSCmZvbwpiYXI</string>
|
||||
<object class="NSFont" key="NSSupport" id="26">
|
||||
<string key="NSName">LucidaGrande</string>
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
<double key="NSSize">11</double>
|
||||
<int key="NSfFlags">3357</int>
|
||||
</object>
|
||||
@@ -153,11 +225,19 @@
|
||||
<reference key="NSTextColor" ref="808666039"/>
|
||||
</object>
|
||||
</object>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
<object class="NSButton" id="901469128">
|
||||
<reference key="NSNextResponder" ref="515227806"/>
|
||||
<int key="NSvFlags">289</int>
|
||||
<string key="NSFrame">{{286, 12}, {157, 32}}</string>
|
||||
<reference key="NSSuperview" ref="515227806"/>
|
||||
=======
|
||||
<object class="NSButton" id="782385580">
|
||||
<reference key="NSNextResponder" ref="590688073"/>
|
||||
<int key="NSvFlags">264</int>
|
||||
<string key="NSFrame">{{104, 50}, {278, 18}}</string>
|
||||
<reference key="NSSuperview" ref="590688073"/>
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="224174199">
|
||||
<int key="NSCellFlags">67239424</int>
|
||||
@@ -178,11 +258,27 @@
|
||||
<int key="NSPeriodicInterval">25</int>
|
||||
</object>
|
||||
</object>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
<object class="NSButton" id="394591750">
|
||||
<reference key="NSNextResponder" ref="515227806"/>
|
||||
<int key="NSvFlags">288</int>
|
||||
<string key="NSFrame">{{103, 12}, {176, 32}}</string>
|
||||
<reference key="NSSuperview" ref="515227806"/>
|
||||
=======
|
||||
<object class="NSImageView" id="998191392">
|
||||
<reference key="NSNextResponder" ref="590688073"/>
|
||||
<int key="NSvFlags">264</int>
|
||||
<set class="NSMutableSet" key="NSDragTypes">
|
||||
<string>Apple PDF pasteboard type</string>
|
||||
<string>Apple PICT pasteboard type</string>
|
||||
<string>Apple PNG pasteboard type</string>
|
||||
<string>NSFilenamesPboardType</string>
|
||||
<string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
|
||||
<string>NeXT TIFF v4.0 pasteboard type</string>
|
||||
</set>
|
||||
<string key="NSFrame">{{23, 104}, {64, 64}}</string>
|
||||
<reference key="NSSuperview" ref="590688073"/>
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="707536437">
|
||||
<int key="NSCellFlags">67239424</int>
|
||||
@@ -201,11 +297,19 @@
|
||||
<int key="NSPeriodicInterval">25</int>
|
||||
</object>
|
||||
</object>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
<object class="NSButton" id="253555594">
|
||||
<reference key="NSNextResponder" ref="515227806"/>
|
||||
<int key="NSvFlags">289</int>
|
||||
<string key="NSFrame">{{443, 12}, {129, 32}}</string>
|
||||
<reference key="NSSuperview" ref="515227806"/>
|
||||
=======
|
||||
<object class="NSButton" id="899489358">
|
||||
<reference key="NSNextResponder" ref="590688073"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{83, 47}, {27, 26}}</string>
|
||||
<reference key="NSSuperview" ref="590688073"/>
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="296786110">
|
||||
<int key="NSCellFlags">-2080244224</int>
|
||||
@@ -222,6 +326,7 @@
|
||||
<int key="NSPeriodicInterval">25</int>
|
||||
</object>
|
||||
</object>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
<object class="NSBox" id="226392937">
|
||||
<reference key="NSNextResponder" ref="515227806"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
@@ -254,6 +359,89 @@
|
||||
<string>public.png</string>
|
||||
<string>public.url</string>
|
||||
<string>public.url-name</string>
|
||||
=======
|
||||
</array>
|
||||
<string key="NSFrameSize">{471, 188}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
|
||||
<string key="NSMinSize">{213, 129}</string>
|
||||
<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
|
||||
</object>
|
||||
<object class="NSArrayController" id="866560408">
|
||||
<array class="NSMutableArray" key="NSDeclaredKeys">
|
||||
<string>visibleKey</string>
|
||||
<string>visibleValue</string>
|
||||
<string>displayValue</string>
|
||||
<string>displayKey</string>
|
||||
</array>
|
||||
<object class="_NSManagedProxy" key="_NSManagedProxy"/>
|
||||
<bool key="NSAvoidsEmptySelection">YES</bool>
|
||||
<bool key="NSPreservesSelection">YES</bool>
|
||||
<bool key="NSSelectsInsertedObjects">YES</bool>
|
||||
<bool key="NSFilterRestrictsInsertion">YES</bool>
|
||||
<bool key="NSClearsFilterPredicateOnInsertion">YES</bool>
|
||||
</object>
|
||||
<object class="NSCustomView" id="742287071">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="NSScrollView" id="401033039">
|
||||
<reference key="NSNextResponder" ref="742287071"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="NSClipView" id="404495964">
|
||||
<reference key="NSNextResponder" ref="401033039"/>
|
||||
<int key="NSvFlags">2304</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="NSTableView" id="212288360">
|
||||
<reference key="NSNextResponder" ref="404495964"/>
|
||||
<int key="NSvFlags">4352</int>
|
||||
<string key="NSFrameSize">{356, 162}</string>
|
||||
<reference key="NSSuperview" ref="404495964"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="_NSCornerView" key="NSCornerView">
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<string key="NSFrame">{{346, 0}, {12, 17}}</string>
|
||||
</object>
|
||||
<array class="NSMutableArray" key="NSTableColumns">
|
||||
<object class="NSTableColumn" id="757871811">
|
||||
<double key="NSWidth">128</double>
|
||||
<double key="NSMinWidth">40</double>
|
||||
<double key="NSMaxWidth">1000</double>
|
||||
<object class="NSTableHeaderCell" key="NSHeaderCell">
|
||||
<int key="NSCellFlags">75628096</int>
|
||||
<int key="NSCellFlags2">2048</int>
|
||||
<string key="NSContents"/>
|
||||
<reference key="NSSupport" ref="26"/>
|
||||
<object class="NSColor" key="NSBackgroundColor" id="493102381">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC4zMzMzMzI5OQA</bytes>
|
||||
</object>
|
||||
<object class="NSColor" key="NSTextColor" id="842442180">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">headerTextColor</string>
|
||||
<reference key="NSColor" ref="792721716"/>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSTextFieldCell" key="NSDataCell" id="34203081">
|
||||
<int key="NSCellFlags">69336577</int>
|
||||
<int key="NSCellFlags2">131072</int>
|
||||
<reference key="NSSupport" ref="26"/>
|
||||
<reference key="NSControlView" ref="212288360"/>
|
||||
<object class="NSColor" key="NSBackgroundColor" id="208318179">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">textBackgroundColor</string>
|
||||
<object class="NSColor" key="NSColor" id="300983041">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
<reference key="NSTextColor" ref="597588148"/>
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrame">{{-1, 0}, {456, 197}}</string>
|
||||
@@ -361,6 +549,36 @@
|
||||
<int key="NSPeriodicDelay">200</int>
|
||||
<int key="NSPeriodicInterval">25</int>
|
||||
</object>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
=======
|
||||
</array>
|
||||
<string key="NSFrame">{{4, 5}, {358, 164}}</string>
|
||||
<reference key="NSSuperview" ref="742287071"/>
|
||||
<reference key="NSNextKeyView" ref="404495964"/>
|
||||
<int key="NSsFlags">530</int>
|
||||
<reference key="NSVScroller" ref="459105233"/>
|
||||
<reference key="NSHScroller" ref="736321418"/>
|
||||
<reference key="NSContentView" ref="404495964"/>
|
||||
<bytes key="NSScrollAmts">AAAAAAAAAABBgAAAQYAAAA</bytes>
|
||||
</object>
|
||||
<object class="NSTextField" id="591470794">
|
||||
<reference key="NSNextResponder" ref="742287071"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<string key="NSFrame">{{1, 177}, {361, 70}}</string>
|
||||
<reference key="NSSuperview" ref="742287071"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="312225997">
|
||||
<int key="NSCellFlags">67239424</int>
|
||||
<int key="NSCellFlags2">272629760</int>
|
||||
<string type="base64-UTF8" key="NSContents">TGEgaW5mb3JtYWNpw7NuIGRlIHBlcmZpbCBkZSBzaXN0ZW1hIGFuw7NuaW1vIHNlIHVzYSBwYXJhIGF5
|
||||
dWRhcm5vcyBhIHBsYW5lYXIgZWwgdHJhYmFqbyBkZSBkZXNhcnJvbGxvIGZ1dHVyby4gUG9yIGZhdm9y
|
||||
LCBww7NuZ2FzZSBlbiBjb250YWN0byBjb24gbm9zb3Ryb3Mgc2kgdGllbmUgcHJlZ3VudGFzIHNvYnJl
|
||||
IGVzdG8uCgpFc3RhIGVzIGxhIGluZm9ybWFjacOzbiBxdWUgc2Vyw61hIGVudmlhZGE6A</string>
|
||||
<reference key="NSSupport" ref="26"/>
|
||||
<reference key="NSControlView" ref="591470794"/>
|
||||
<reference key="NSBackgroundColor" ref="138804755"/>
|
||||
<reference key="NSTextColor" ref="597588148"/>
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{586, 370}</string>
|
||||
@@ -871,6 +1089,69 @@
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
=======
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
<string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="-3.ImportedFromIB2"/>
|
||||
<string key="13.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="13.ImportedFromIB2"/>
|
||||
<string key="14.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="14.ImportedFromIB2"/>
|
||||
<string key="163.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="164.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="165.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="166.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="167.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="168.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="169.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="170.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="171.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="171.IBShouldRemoveOnLegacySave"/>
|
||||
<string key="172.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="172.IBShouldRemoveOnLegacySave"/>
|
||||
<string key="24.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="24.ImportedFromIB2"/>
|
||||
<string key="32.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="32.ImportedFromIB2"/>
|
||||
<string key="33.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="33.ImportedFromIB2"/>
|
||||
<string key="34.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="34.ImportedFromIB2"/>
|
||||
<string key="37.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="37.ImportedFromIB2"/>
|
||||
<string key="39.IBEditorWindowLastContentRect">{{0, 591}, {365, 254}}</string>
|
||||
<string key="39.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="39.ImportedFromIB2"/>
|
||||
<string key="40.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="40.ImportedFromIB2"/>
|
||||
<string key="41.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="41.ImportedFromIB2"/>
|
||||
<string key="42.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="42.ImportedFromIB2"/>
|
||||
<string key="43.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="43.ImportedFromIB2"/>
|
||||
<string key="44.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="44.ImportedFromIB2"/>
|
||||
<string key="45.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="45.ImportedFromIB2"/>
|
||||
<string key="46.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="46.ImportedFromIB2"/>
|
||||
<string key="49.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="49.ImportedFromIB2"/>
|
||||
<string key="5.IBEditorWindowLastContentRect">{{0, 657}, {471, 188}}</string>
|
||||
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="5.IBWindowTemplateEditedContentRect">{{0, 657}, {471, 188}}</string>
|
||||
<boolean value="YES" key="5.ImportedFromIB2"/>
|
||||
<boolean value="YES" key="5.windowTemplate.hasMinSize"/>
|
||||
<string key="5.windowTemplate.minSize">{213, 107}</string>
|
||||
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="6.ImportedFromIB2"/>
|
||||
<string key="71.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES" key="71.ImportedFromIB2"/>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
<nil key="activeLocalization"/>
|
||||
<object class="NSMutableDictionary" key="localizations">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@@ -880,7 +1161,11 @@
|
||||
</object>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
<int key="maxID">176</int>
|
||||
=======
|
||||
<int key="maxID">188</int>
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
@@ -960,6 +1245,7 @@
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">SUUpdateAlert</string>
|
||||
<string key="superclassName">SUWindowController</string>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
@@ -998,6 +1284,50 @@
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">SUUpdateAlert</string>
|
||||
=======
|
||||
<dictionary class="NSMutableDictionary" key="actions">
|
||||
<string key="finishPrompt:">id</string>
|
||||
<string key="toggleMoreInfo:">id</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="actionInfosByName">
|
||||
<object class="IBActionInfo" key="finishPrompt:">
|
||||
<string key="name">finishPrompt:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="toggleMoreInfo:">
|
||||
<string key="name">toggleMoreInfo:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="delegate">id</string>
|
||||
<string key="descriptionTextField">NSTextField</string>
|
||||
<string key="moreInfoButton">NSButton</string>
|
||||
<string key="moreInfoView">NSView</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="delegate">
|
||||
<string key="name">delegate</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="descriptionTextField">
|
||||
<string key="name">descriptionTextField</string>
|
||||
<string key="candidateClassName">NSTextField</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="moreInfoButton">
|
||||
<string key="name">moreInfoButton</string>
|
||||
<string key="candidateClassName">NSButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="moreInfoView">
|
||||
<string key="name">moreInfoView</string>
|
||||
<string key="candidateClassName">NSView</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<reference key="sourceIdentifier" ref="902463418"/>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">SUUpdatePermissionPrompt</string>
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
<string key="superclassName">SUWindowController</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBUserSource</string>
|
||||
@@ -1562,6 +1892,13 @@
|
||||
<string key="NS.key.0">showWindow:</string>
|
||||
<string key="NS.object.0">id</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
<string key="NS.key.0">showWindow:</string>
|
||||
<object class="IBActionInfo" key="NS.object.0">
|
||||
<string key="name">showWindow:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string>
|
||||
@@ -1625,9 +1962,16 @@
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<string key="IBDocument.LastKnownRelativeProjectPath">../Sparkle.xcodeproj</string>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<<<<<<< HEAD:is.lproj/SUUpdateAlert.xib
|
||||
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
|
||||
<string key="NS.key.0">NSApplicationIcon</string>
|
||||
<string key="NS.object.0">{128, 128}</string>
|
||||
</object>
|
||||
=======
|
||||
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
|
||||
<string key="NSApplicationIcon">{128, 128}</string>
|
||||
<string key="NSSwitch">{15, 15}</string>
|
||||
</dictionary>
|
||||
>>>>>>> 3ea1a9eee44c1f45c85fa82254ddee2fddf8302f:es.lproj/SUUpdatePermissionPrompt.nib/designable.nib
|
||||
</data>
|
||||
</archive>
|
||||
Binary file not shown.
Executable
BIN
Binary file not shown.
+21
-11
@@ -1,20 +1,28 @@
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#import <unistd.h>
|
||||
|
||||
@interface TerminationListener : NSObject
|
||||
{
|
||||
@private
|
||||
const char *executablePath;
|
||||
pid_t parentProcessId;
|
||||
}
|
||||
|
||||
- (void) relaunch;
|
||||
- (void)relaunch __dead2;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TerminationListener
|
||||
|
||||
- (void)watchdog:(NSTimer *)timer
|
||||
{
|
||||
ProcessSerialNumber psn;
|
||||
if (GetProcessForPID(parentProcessId, &psn) == procNotFound)
|
||||
[self relaunch];
|
||||
}
|
||||
|
||||
- (id) initWithExecutablePath:(const char *)execPath parentProcessId:(pid_t)ppid
|
||||
{
|
||||
self = [super init];
|
||||
@@ -29,17 +37,19 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)watchdog:(NSTimer *)timer
|
||||
{
|
||||
ProcessSerialNumber psn;
|
||||
if (GetProcessForPID(parentProcessId, &psn) == procNotFound)
|
||||
[self relaunch];
|
||||
}
|
||||
|
||||
- (void) relaunch
|
||||
{
|
||||
[[NSWorkspace sharedWorkspace] openFile:[[NSFileManager defaultManager] stringWithFileSystemRepresentation:executablePath length:strlen(executablePath)]];
|
||||
[[NSFileManager defaultManager] removeFileAtPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"relaunch"] handler:nil];
|
||||
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:path handler:nil];
|
||||
#else
|
||||
[[NSFileManager defaultManager] removeItemAtPath:path error:nil];
|
||||
#endif
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user