diff --git a/Elgato/ThreadSafePreferences.h b/Elgato/ThreadSafePreferences.h new file mode 100755 index 00000000..4545cb02 --- /dev/null +++ b/Elgato/ThreadSafePreferences.h @@ -0,0 +1,15 @@ +// Header that shouldn't be included in anything but the Sparkle finish_installation tool +// because it includes files also used in EyeTV, but doesn't need to be thread safe +// as it's a single-threaded process anyway. + +#if !EYETV && !__TOAST__ && !TURBO + +#define ThreadSafePreferences_CopyAppValue CFPreferencesCopyAppValue +#define ThreadSafePreferences_SetValue CFPreferencesSetValue +#define ThreadSafePreferences_Synchronize CFPreferencesSynchronize + +#else + +#error This header shouldn't be included here! + +#endif diff --git a/NTSynchronousTask.h b/NTSynchronousTask.h index 1cf5c04e..7f2a14d1 100644 --- a/NTSynchronousTask.h +++ b/NTSynchronousTask.h @@ -22,7 +22,7 @@ // pass nil for directory if not needed // returns the result -+ (NSData*)task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input; ++(int) task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input output: (NSData**)outData; @end diff --git a/NTSynchronousTask.m b/NTSynchronousTask.m index d506cad5..b64c2dab 100644 --- a/NTSynchronousTask.m +++ b/NTSynchronousTask.m @@ -6,7 +6,11 @@ // Copyright 2005 Steve Gehrman. All rights reserved. // -#import "Sparkle.h" +#import "SUUpdater.h" + +#import "SUAppcast.h" +#import "SUAppcastItem.h" +#import "SUVersionComparisonProtocol.h" #import "NTSynchronousTask.h" @interface NTSynchronousTask (Private) @@ -44,6 +48,7 @@ [[self task] setStandardInput:[self inputPipe]]; [[self task] setStandardOutput:[self outputPipe]]; + [[self task] setStandardError:[self outputPipe]]; } return self; @@ -64,11 +69,13 @@ [super dealloc]; } -+ (NSData*)task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input; ++(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]; - NSData* result=nil; + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + int taskResult = 0; + if( outData ) + *outData = nil; NS_DURING { @@ -76,20 +83,23 @@ [task run:toolPath directory:currentDirectory withArgs:args input:input]; - if ([task result] == 0) - result = [[task output] retain]; + taskResult = [task result]; + if( outData ) + *outData = [[task output] retain]; [task release]; } NS_HANDLER; + taskResult = errCppGeneral; NS_ENDHANDLER; [pool drain]; // retained above - [result autorelease]; + if( outData ) + [*outData autorelease]; - return result; + return taskResult; } @end diff --git a/SUAppcast.m b/SUAppcast.m index 056b2d81..41ef2dff 100644 --- a/SUAppcast.m +++ b/SUAppcast.m @@ -6,8 +6,15 @@ // Copyright 2006 Andy Matuschak. All rights reserved. // -#import "Sparkle.h" +#import "SUUpdater.h" + #import "SUAppcast.h" +#import "SUAppcastItem.h" +#import "SUVersionComparisonProtocol.h" +#import "SUAppcast.h" +#import "SUConstants.h" +#import "SULog.h" + @interface SUAppcast (Private) - (void)reportError:(NSError *)error; @@ -19,7 +26,12 @@ - (void)dealloc { [items release]; + items = nil; [userAgentString release]; + userAgentString = nil; + [downloadFilename release]; + downloadFilename = nil; + [super dealloc]; } @@ -59,6 +71,12 @@ 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 MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 [[NSFileManager defaultManager] removeFileAtPath:downloadFilename handler:nil]; #else diff --git a/SUAppcastItem.h b/SUAppcastItem.h index 010c892a..6cbd4748 100644 --- a/SUAppcastItem.h +++ b/SUAppcastItem.h @@ -24,6 +24,8 @@ NSString *displayVersionString; NSDictionary *propertiesDictionary; + + NSURL *infoURL; // UK 2007-08-31 } // Initializes with data from a dictionary provided by the RSS class. @@ -43,6 +45,8 @@ // Returns the dictionary provided in initWithDictionary; this might be useful later for extensions. - (NSDictionary *)propertiesDictionary; +- (NSURL *)infoURL; // UK 2007-08-31 + @end #endif diff --git a/SUAppcastItem.m b/SUAppcastItem.m index f17ce493..116ab157 100644 --- a/SUAppcastItem.m +++ b/SUAppcastItem.m @@ -6,7 +6,11 @@ // Copyright 2006 Andy Matuschak. All rights reserved. // -#import "Sparkle.h" +#import "SUUpdater.h" + +#import "SUAppcast.h" +#import "SUAppcastItem.h" +#import "SUVersionComparisonProtocol.h" #import "SUAppcastItem.h" @implementation SUAppcastItem @@ -101,6 +105,16 @@ minimumSystemVersion = [systemVersionString copy]; } + +- (NSURL *)infoURL { return [[infoURL retain] autorelease]; } // UK 2007-08-31 (whole method) + +- (void)setInfoURL:(NSURL *)aFileURL // UK 2007-08-31 (whole method) +{ + if( aFileURL == infoURL ) return; + [infoURL release]; + infoURL = [aFileURL copy]; +} + - initWithDictionary:(NSDictionary *)dict { return [self initWithDictionary:dict failureReason:nil]; @@ -130,7 +144,9 @@ // The big caveat with this is that you can't have underscores in your version strings, as that'll confuse Sparkle. // Feel free to change the separator string to a hyphen or something more suited to your needs if you like. NSString *newVersion = [enclosure objectForKey:@"sparkle:version"]; - if (newVersion == nil) // no sparkle:version attribute + if( newVersion == nil ) + newVersion = [dict objectForKey:@"sparkle:version"]; // UK 2007-08-31 Get version from the item, in case it's a download-less item (i.e. paid upgrade). + if (newVersion == nil) // no sparkle:version attribute anywhere? { // Separate the url by underscores and take the last component, as that'll be closest to the end, // then we remove the extension. Hopefully, this will be the version. @@ -160,7 +176,16 @@ [self setDate:[dict objectForKey:@"pubDate"]]; [self setItemDescription:[dict objectForKey:@"description"]]; - [self setFileURL:[NSURL URLWithString:[[enclosure objectForKey:@"url"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]; + NSString* theInfoURL = [dict objectForKey:@"link"]; + if( theInfoURL ) + { + if( ![theInfoURL isKindOfClass: [NSString class]] ) + NSLog(@"SUAppcastItem -initWithDictionary: Info URL is not of valid type."); + else + [self setInfoURL:[NSURL URLWithString:theInfoURL]]; + } + + [self setFileURL:[NSURL URLWithString:[[enclosure objectForKey:@"url"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]; [self setDSASignature:[enclosure objectForKey:@"sparkle:dsaSignature"]]; [self setVersionString:newVersion]; @@ -193,6 +218,7 @@ [self setFileURL:nil]; [self setVersionString:nil]; [self setDisplayVersionString:nil]; + [self setInfoURL:nil]; [propertiesDictionary release]; [super dealloc]; } diff --git a/SUAutomaticUpdateAlert.m b/SUAutomaticUpdateAlert.m index d30025f1..f055f48d 100644 --- a/SUAutomaticUpdateAlert.m +++ b/SUAutomaticUpdateAlert.m @@ -33,7 +33,7 @@ [super dealloc]; } -- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [host bundlePath]]; } +- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@, %@>", [self class], [host bundlePath], [host installationPath]]; } - (IBAction)installNow:sender { diff --git a/SUAutomaticUpdateDriver.m b/SUAutomaticUpdateDriver.m index 9a409821..fb8fcd1a 100644 --- a/SUAutomaticUpdateDriver.m +++ b/SUAutomaticUpdateDriver.m @@ -10,6 +10,7 @@ #import "SUAutomaticUpdateAlert.h" #import "SUHost.h" +#import "SUConstants.h" @implementation SUAutomaticUpdateDriver diff --git a/SUBasicUpdateDriver.m b/SUBasicUpdateDriver.m index 2e2025d8..dba63e16 100644 --- a/SUBasicUpdateDriver.m +++ b/SUBasicUpdateDriver.m @@ -13,6 +13,9 @@ #import "SUInstaller.h" #import "SUStandardVersionComparator.h" #import "SUUnarchiver.h" +#import "SUConstants.h" +#import "SULog.h" + @implementation SUBasicUpdateDriver @@ -165,6 +168,7 @@ - (void)downloadDidFinish:(NSURLDownload *)d { + #if 0 // +++ // New in Sparkle 1.5: we're now checking signatures on all non-secure downloads, where "secure" is defined as both the appcast and the download being transmitted over SSL. NSURL *downloadURL = [[d request] URL]; if (!(([[downloadURL scheme] isEqualToString:@"https"] && [[appcastURL scheme] isEqualToString:@"https"]) || @@ -176,6 +180,7 @@ return; } } + #endif [self extractUpdate]; } @@ -200,7 +205,7 @@ SUUnarchiver *unarchiver = [SUUnarchiver unarchiverForPath:downloadPath]; if (!unarchiver) { - NSLog(@"Sparkle Error: No valid unarchiver for %@!", downloadPath); + SULog(@"Sparkle Error: No valid unarchiver for %@!", downloadPath); [self unarchiverDidFail:nil]; return; } @@ -231,7 +236,11 @@ NSString *relaunchPathToCopy = [[NSBundle bundleForClass:[self class]] pathForResource:@"finish_installation" ofType:@""]; NSString *appSupportFolder = [[@"~/Library/Application Support/" stringByExpandingTildeInPath] stringByAppendingPathComponent: [host name]]; NSString *targetPath = [appSupportFolder stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]]; - [[NSFileManager defaultManager] createDirectoryAtPath: targetPath withIntermediateDirectories: YES attributes: [NSDictionary dictionary] error: NULL]; +#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 + [[NSFileManager defaultManager] createDirectoryAtPath: [targetPath stringByDeletingLastPathComponent] attributes: [NSDictionary dictionary]]; +#else + [[NSFileManager defaultManager] createDirectoryAtPath: [targetPath stringByDeletingLastPathComponent] withIntermediateDirectories: YES attributes: [NSDictionary dictionary] error: NULL]; +#endif // Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems. NSError *error = nil; @@ -251,36 +260,43 @@ - (void)installAndRelaunchWithTool { - // Give the host app an opportunity to postpone the relaunch. - static BOOL postponedOnce = NO; - if (!postponedOnce && [[updater delegate] respondsToSelector:@selector(updater:shouldPostponeRelaunchForUpdate:untilInvoking:)]) - { - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[self class] instanceMethodSignatureForSelector:@selector(relaunchHostApp)]]; - [invocation setSelector:@selector(relaunchHostApp)]; - [invocation setTarget:self]; - postponedOnce = YES; - if ([[updater delegate] updater:updater shouldPostponeRelaunchForUpdate:updateItem untilInvoking:invocation]) - return; - } - - [[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterWillRestartNotification object:self]; - if ([[updater delegate] respondsToSelector:@selector(updaterWillRelaunchApplication:)]) - [[updater delegate] updaterWillRelaunchApplication:updater]; - - if(!relaunchPath || ![[NSFileManager defaultManager] fileExistsAtPath:relaunchPath]) - { - // Note that we explicitly use the host app's name here, since updating plugin for Mail relaunches Mail, not just the plugin. - [self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:SULocalizedString(@"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@.", nil), [host name]], NSLocalizedDescriptionKey, [NSString stringWithFormat:@"Couldn't find the relauncher (expected to find it at %@)", relaunchPath], NSLocalizedFailureReasonErrorKey, nil]]]; - // We intentionally don't abandon the update here so that the host won't initiate another. - return; - } - - NSString *pathToRelaunch = [host bundlePath]; - if ([[updater delegate] respondsToSelector:@selector(pathToRelaunchForUpdater:)]) - pathToRelaunch = [[updater delegate] pathToRelaunchForUpdater:updater]; - [NSTask launchedTaskWithLaunchPath:relaunchPath arguments:[NSArray arrayWithObjects:pathToRelaunch, [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]], [downloadPath stringByDeletingLastPathComponent], nil]]; + BOOL mayRelaunchAtAll = [updater mayUpdateAndRestart]; - [NSApp terminate:self]; + if( mayRelaunchAtAll ) + { + // Give the host app an opportunity to postpone the relaunch. + static BOOL postponedOnce = NO; + if (!postponedOnce && [[updater delegate] respondsToSelector:@selector(updater:shouldPostponeRelaunchForUpdate:untilInvoking:)]) + { + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[self class] instanceMethodSignatureForSelector:@selector(relaunchHostApp)]]; + [invocation setSelector:@selector(relaunchHostApp)]; + [invocation setTarget:self]; + postponedOnce = YES; + if ([[updater delegate] updater:updater shouldPostponeRelaunchForUpdate:updateItem untilInvoking:invocation]) + return; + } + + [[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterWillRestartNotification object:self]; + if ([[updater delegate] respondsToSelector:@selector(updaterWillRelaunchApplication:)]) + [[updater delegate] updaterWillRelaunchApplication:updater]; + + if(!relaunchPath || ![[NSFileManager defaultManager] fileExistsAtPath:relaunchPath]) + { + // Note that we explicitly use the host app's name here, since updating plugin for Mail relaunches Mail, not just the plugin. + [self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:SULocalizedString(@"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@.", nil), [host name]], NSLocalizedDescriptionKey, [NSString stringWithFormat:@"Couldn't find the relauncher (expected to find it at %@)", relaunchPath], NSLocalizedFailureReasonErrorKey, nil]]]; + // We intentionally don't abandon the update here so that the host won't initiate another. + return; + } + + NSString *pathToRelaunch = [host bundlePath]; + if ([[updater delegate] respondsToSelector:@selector(pathToRelaunchForUpdater:)]) + pathToRelaunch = [[updater delegate] pathToRelaunchForUpdater:updater]; + [NSTask launchedTaskWithLaunchPath:relaunchPath arguments:[NSArray arrayWithObjects:pathToRelaunch, [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]], [downloadPath stringByDeletingLastPathComponent], nil]]; + + [NSApp terminate:self]; + } + else + [self abortUpdate]; } - (void)cleanUp @@ -295,11 +311,13 @@ - (void)installerForHost:(SUHost *)aHost failedWithError:(NSError *)error { if (aHost != host) { return; } + [[NSFileManager defaultManager] removeFileAtPath:relaunchPath handler:NULL]; // Clean up the copied relauncher. [self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while installing the update. Please try again later.", nil), NSLocalizedDescriptionKey, [error localizedDescription], NSLocalizedFailureReasonErrorKey, nil]]]; } - (void)abortUpdate { + [[self retain] autorelease]; // In case the notification center was the last one holding on to us. [[NSNotificationCenter defaultCenter] removeObserver:self]; [super abortUpdate]; } @@ -307,9 +325,9 @@ - (void)abortUpdateWithError:(NSError *)error { if ([error code] != SUNoUpdateError) // Let's not bother logging this. - NSLog(@"Sparkle Error: %@", [error localizedDescription]); + SULog(@"Sparkle Error: %@", [error localizedDescription]); if ([error localizedFailureReason]) - NSLog(@"Sparkle Error (continued): %@", [error localizedFailureReason]); + SULog(@"Sparkle Error (continued): %@", [error localizedFailureReason]); if (download) [download cancel]; [self abortUpdate]; diff --git a/SUConstants.h b/SUConstants.h index e9d8e958..dcdba8de 100644 --- a/SUConstants.h +++ b/SUConstants.h @@ -11,9 +11,18 @@ #define SUCONSTANTS_H +// ----------------------------------------------------------------------------- +// Notifications: +// ----------------------------------------------------------------------------- + extern NSString *SUUpdaterWillRestartNotification; + extern NSString *SUTechnicalErrorInformationKey; +// ----------------------------------------------------------------------------- +// PList keys:: +// ----------------------------------------------------------------------------- + extern NSString *SUFeedURLKey; extern NSString *SUHasLaunchedBeforeKey; extern NSString *SUShowReleaseNotesKey; @@ -29,6 +38,12 @@ extern NSString *SUEnableAutomaticChecksKeyOld; extern NSString *SUEnableSystemProfilingKey; extern NSString *SUSendProfileInfoKey; extern NSString *SULastProfileSubmitDateKey; +extern NSString *SUFixedHTMLDisplaySizeKey; +extern NSString *SUKeepDownloadOnFailedInstallKey; + +// ----------------------------------------------------------------------------- +// Errors: +// ----------------------------------------------------------------------------- extern NSString *SUSparkleErrorDomain; // Appcast phase errors. @@ -53,6 +68,11 @@ extern OSStatus SURelaunchError; extern OSStatus SUInstallationError; extern OSStatus SUDowngradeError; + +// ----------------------------------------------------------------------------- +// NSInteger fixer-upper: +// ----------------------------------------------------------------------------- + // NSInteger is a type that was added to Leopard. // Here is some glue to ensure that NSInteger will work with pre-10.5 SDKs: #ifndef NSINTEGER_DEFINED diff --git a/SUConstants.m b/SUConstants.m index ae91584f..941137ba 100644 --- a/SUConstants.m +++ b/SUConstants.m @@ -6,7 +6,11 @@ // Copyright 2006 Andy Matuschak. All rights reserved. // -#import "Sparkle.h" +#import "SUUpdater.h" + +#import "SUAppcast.h" +#import "SUAppcastItem.h" +#import "SUVersionComparisonProtocol.h" #import "SUConstants.h" NSString *SUUpdaterWillRestartNotification = @"SUUpdaterWillRestartNotificationName"; @@ -28,6 +32,8 @@ NSString *SUEnableAutomaticChecksKey = @"SUEnableAutomaticChecks"; NSString *SUEnableAutomaticChecksKeyOld = @"SUCheckAtStartup"; NSString *SUSendProfileInfoKey = @"SUSendProfileInfo"; NSString *SULastProfileSubmitDateKey = @"SULastProfileSubmissionDate"; +NSString *SUFixedHTMLDisplaySizeKey = @"SUFixedHTMLDisplaySize"; +NSString *SUKeepDownloadOnFailedInstallKey = @"SUKeepDownloadOnFailedInstall"; NSString *SUSparkleErrorDomain = @"SUSparkleErrorDomain"; OSStatus SUAppcastParseError = 1000; diff --git a/SUDSAVerifier.h b/SUDSAVerifier.h index 785e49c2..dd8a6aad 100644 --- a/SUDSAVerifier.h +++ b/SUDSAVerifier.h @@ -9,6 +9,8 @@ #ifndef SUDSAVERIFIER_H #define SUDSAVERIFIER_H +#import + // For the paranoid folks! @interface SUDSAVerifier : NSObject {} + (BOOL)validatePath:(NSString *)path withEncodedDSASignature:(NSString *)encodedSignature withPublicDSAKey:(NSString *)pkeyString; diff --git a/SUDSAVerifier.m b/SUDSAVerifier.m index e9ee03e5..ebf419db 100644 --- a/SUDSAVerifier.m +++ b/SUDSAVerifier.m @@ -9,6 +9,7 @@ // DSA stuff adapted from code provided by Allan Odgaard. Thanks, Allan! #import "SUDSAVerifier.h" +#import #import #import @@ -17,6 +18,11 @@ #import #import +// Alex: Avoid prototype warning +long b64decode(unsigned char* str); +EVP_PKEY* load_dsa_key(char *key); + + long b64decode(unsigned char* str) { unsigned char *cur, *start; diff --git a/SUDiskImageUnarchiver.m b/SUDiskImageUnarchiver.m index a7c5f633..908a7722 100644 --- a/SUDiskImageUnarchiver.m +++ b/SUDiskImageUnarchiver.m @@ -9,8 +9,10 @@ #import "SUDiskImageUnarchiver.h" #import "SUUnarchiver_Private.h" #import "NTSynchronousTask.h" +#import "SULog.h" #import + @implementation SUDiskImageUnarchiver + (BOOL)_canUnarchivePath:(NSString *)path @@ -25,9 +27,13 @@ - (void)_extractDMG { + // GETS CALLED ON NON-MAIN THREAD!!! + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; BOOL mountedSuccessfully = NO; + SULog(@"Extracting %@ as a DMG", archivePath); + // get a unique mount point path NSString *mountPointName = nil; NSString *mountPoint = nil; @@ -46,13 +52,19 @@ } while (noErr == FSPathMakeRefWithOptions((UInt8 *)[mountPoint fileSystemRepresentation], kFSPathMakeRefDoNotFollowLeafSymlink, &tmpRef, NULL)); - NSArray* arguments = [NSArray arrayWithObjects:@"attach", archivePath, @"-mountpoint", mountPoint, @"-noverify", @"-nobrowse", @"-noautoopen", nil]; + NSArray* arguments = [NSArray arrayWithObjects:@"attach", archivePath, @"-mountpoint", mountPoint, /*@"-noverify",*/ @"-nobrowse", @"-noautoopen", nil]; // set up a pipe and push "yes" (y works too), this will accept any license agreement crap // not every .dmg needs this, but this will make sure it works with everyone NSData* yesData = [[[NSData alloc] initWithBytes:"yes\n" length:4] autorelease]; - NSData *result = [NTSynchronousTask task:@"/usr/bin/hdiutil" directory:@"/" withArgs:arguments input:yesData]; - if (!result) goto reportError; + NSData *output = nil; + int returnCode = [NTSynchronousTask task:@"/usr/bin/hdiutil" directory:@"/" withArgs:arguments input:yesData output: &output]; + if ( returnCode != 0 ) + { + NSString* resultStr = output ? [[[NSString alloc] initWithData: output encoding: NSUTF8StringEncoding] autorelease] : nil; + SULog( @"hdiutil failed with code: %d data: <<%@>>", returnCode, resultStr ); + goto reportError; + } mountedSuccessfully = YES; // Now that we've mounted it, we need to copy out its contents. @@ -75,6 +87,8 @@ reportError: finally: if (mountedSuccessfully) [NSTask launchedTaskWithLaunchPath:@"/usr/bin/hdiutil" arguments:[NSArray arrayWithObjects:@"detach", mountPoint, @"-force", nil]]; + else + SULog(@"Can't mount DMG %@",archivePath); [pool drain]; } diff --git a/SUHost.h b/SUHost.h index f8f8203f..136ece08 100644 --- a/SUHost.h +++ b/SUHost.h @@ -5,7 +5,10 @@ // Copyright 2008 Andy Matuschak. All rights reserved. // -#import "Sparkle.h" +#import "SUUpdater.h" +#import "SUAppcast.h" +#import "SUAppcastItem.h" +#import "SUVersionComparisonProtocol.h" @interface SUHost : NSObject { @@ -17,6 +20,7 @@ - (id)initWithBundle:(NSBundle *)aBundle; - (NSBundle *)bundle; - (NSString *)bundlePath; +- (NSString *)installationPath; - (NSString *)name; - (NSString *)version; - (NSString *)displayVersion; diff --git a/SUHost.m b/SUHost.m index 8665438c..3e4f65db 100644 --- a/SUHost.m +++ b/SUHost.m @@ -10,6 +10,9 @@ #import "SUConstants.h" #import "SUSystemProfiler.h" #import // For statfs for isRunningOnReadOnlyVolume +#import "ThreadSafePreferences.h" +#import "SULog.h" + @implementation SUHost @@ -31,7 +34,7 @@ [super dealloc]; } -- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [self bundlePath]]; } +- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@, %@>", [self class], [self bundlePath], [self installationPath]]; } - (NSBundle *)bundle { @@ -43,6 +46,15 @@ return [bundle bundlePath]; } +- (NSString *)installationPath +{ +#if 1 + return [[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent: [NSString stringWithFormat: @"%@.%@", [bundle objectForInfoDictionaryKey:@"CFBundleName"], [[bundle bundlePath] pathExtension]]]; +#else + return [bundle bundlePath]; +#endif +} + - (NSString *)name { NSString *name = [bundle objectForInfoDictionaryKey:@"CFBundleDisplayName"]; @@ -115,7 +127,7 @@ // More likely, we've got a reference to a Resources file by filename: NSString *keyFilename = [self objectForInfoDictionaryKey:SUPublicDSAKeyFileKey]; if (!keyFilename) { return nil; } - NSError *ignoreErr; + NSError *ignoreErr = nil; return [NSString stringWithContentsOfFile:[bundle pathForResource:keyFilename ofType:nil] encoding:NSASCIIStringEncoding error: &ignoreErr]; } @@ -142,7 +154,7 @@ if (bundle == [NSBundle mainBundle]) return [[NSUserDefaults standardUserDefaults] objectForKey:defaultName]; - CFPropertyListRef obj = CFPreferencesCopyAppValue((CFStringRef)defaultName, (CFStringRef)[bundle bundleIdentifier]); + 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 @@ -159,8 +171,8 @@ } else { - CFPreferencesSetValue((CFStringRef)defaultName, value, (CFStringRef)[bundle bundleIdentifier], kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - CFPreferencesSynchronize((CFStringRef)[bundle bundleIdentifier], kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + ThreadSafePreferences_SetValue((CFStringRef)defaultName, value, (CFStringRef)[bundle bundleIdentifier], kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + ThreadSafePreferences_Synchronize((CFStringRef)[bundle bundleIdentifier], kCFPreferencesCurrentUser, kCFPreferencesAnyHost); } } @@ -170,7 +182,7 @@ return [[NSUserDefaults standardUserDefaults] boolForKey:defaultName]; BOOL value; - CFPropertyListRef plr = CFPreferencesCopyAppValue((CFStringRef)defaultName, (CFStringRef)[bundle bundleIdentifier]); + CFPropertyListRef plr = ThreadSafePreferences_CopyAppValue((CFStringRef)defaultName, (CFStringRef)[bundle bundleIdentifier]); if (plr == NULL) value = NO; else @@ -190,8 +202,8 @@ } else { - CFPreferencesSetValue((CFStringRef)defaultName, (CFBooleanRef)[NSNumber numberWithBool:value], (CFStringRef)[bundle bundleIdentifier], kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - CFPreferencesSynchronize((CFStringRef)[bundle bundleIdentifier], kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + ThreadSafePreferences_SetValue((CFStringRef)defaultName, (CFBooleanRef)[NSNumber numberWithBool:value], (CFStringRef)[bundle bundleIdentifier], kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + ThreadSafePreferences_Synchronize((CFStringRef)[bundle bundleIdentifier], kCFPreferencesCurrentUser, kCFPreferencesAnyHost); } } diff --git a/SUInstaller.h b/SUInstaller.h index 6f12aefd..b35c4a76 100644 --- a/SUInstaller.h +++ b/SUInstaller.h @@ -16,6 +16,8 @@ @interface SUInstaller : NSObject { } + (void)installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator; + (void)_finishInstallationWithResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate; + ++ (NSString*)updateFolder; @end @interface NSObject (SUInstallerDelegateInformalProtocol) diff --git a/SUInstaller.m b/SUInstaller.m index dd8fa73b..69bae86f 100644 --- a/SUInstaller.m +++ b/SUInstaller.m @@ -11,9 +11,18 @@ #import "SUPackageInstaller.h" #import "SUHost.h" #import "SUConstants.h" +#import "SULog.h" + @implementation SUInstaller +static NSString* sUpdateFolder = nil; + ++(NSString*) updateFolder +{ + return sUpdateFolder; +} + + (BOOL)_isAliasFolderAtPath:(NSString *)path { FSRef fileRef; @@ -34,19 +43,23 @@ } -+ (void)installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator ++ (void)installFromUpdateFolder:(NSString *)inUpdateFolder overHost:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator { // Search subdirectories for the application - NSString *currentFile, *newAppDownloadPath = nil, + NSString *currentFile, + *newAppDownloadPath = nil, *bundleFileName = [[host bundlePath] lastPathComponent], - *alternateBundleFileName = [[host name] stringByAppendingPathExtension: [[host bundlePath] pathExtension]]; + *alternateBundleFileName = [[host name] stringByAppendingPathExtension:[[host bundlePath] pathExtension]]; BOOL isPackage = NO; NSString *fallbackPackagePath = nil; - NSDirectoryEnumerator *dirEnum = [[NSFileManager defaultManager] enumeratorAtPath: updateFolder]; + NSDirectoryEnumerator *dirEnum = [[NSFileManager defaultManager] enumeratorAtPath: inUpdateFolder]; + + [sUpdateFolder release]; + sUpdateFolder = [inUpdateFolder retain]; while ((currentFile = [dirEnum nextObject])) { - NSString *currentPath = [updateFolder stringByAppendingPathComponent:currentFile]; + NSString *currentPath = [inUpdateFolder stringByAppendingPathComponent:currentFile]; if ([[currentFile lastPathComponent] isEqualToString:bundleFileName] || [[currentFile lastPathComponent] isEqualToString:alternateBundleFileName]) // We found one! { @@ -106,9 +119,11 @@ + (void)_mdimportHost:(SUHost *)host { + // *** GETS CALLED ON NON-MAIN THREAD! + NSTask *mdimport = [[[NSTask alloc] init] autorelease]; [mdimport setLaunchPath:@"/usr/bin/mdimport"]; - [mdimport setArguments:[NSArray arrayWithObject:[host bundlePath]]]; + [mdimport setArguments:[NSArray arrayWithObject:[host installationPath]]]; @try { [mdimport launch]; @@ -116,23 +131,36 @@ @catch (NSException * launchException) { // No big deal. - NSLog(@"Sparkle Error: %@", [launchException description]); + SULog(@"Sparkle Error: %@", [launchException description]); } } + +#define SUNotifyDictHostKey @"SUNotifyDictHost" +#define SUNotifyDictErrorKey @"SUNotifyDictError" +#define SUNotifyDictDelegateKey @"SUNotifyDictDelegate" + + (void)_finishInstallationWithResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate { + // *** GETS CALLED ON NON-MAIN THREAD! + if (result == YES) { [self _mdimportHost:host]; if ([delegate respondsToSelector:@selector(installerFinishedForHost:)]) - [delegate installerFinishedForHost:host]; + [delegate performSelectorOnMainThread: @selector(installerFinishedForHost:) withObject: host waitUntilDone: NO]; } else { if ([delegate respondsToSelector:@selector(installerForHost:failedWithError:)]) - [delegate installerForHost:host failedWithError:error]; + [self performSelectorOnMainThread: @selector(notifyDelegateOfFailure:) withObject: [NSDictionary dictionaryWithObjectsAndKeys: host, SUNotifyDictHostKey, error, SUNotifyDictErrorKey, delegate, SUNotifyDictDelegateKey, nil] waitUntilDone: NO]; } } + ++(void) notifyDelegateOfFailure: (NSDictionary*)dict +{ + [[dict objectForKey: SUNotifyDictDelegateKey] installerForHost: [dict objectForKey: SUNotifyDictHostKey] failedWithError: [dict objectForKey: SUNotifyDictErrorKey]]; +} + @end diff --git a/SULog.h b/SULog.h new file mode 100644 index 00000000..7631f95e --- /dev/null +++ b/SULog.h @@ -0,0 +1,31 @@ +/* + * SULog.h + * EyeTV + * + * Created by Uli Kusterer on 12/03/2009. + * Copyright 2008 Elgato Systems GmbH. All rights reserved. + * + */ + +/* + Log output for troubleshooting Sparkle failures on end-user machines. + Your tech support will hug you if you tell them about this. +*/ + +#pragma once + +// ----------------------------------------------------------------------------- +// Headers: +// ----------------------------------------------------------------------------- + +#include + + +// ----------------------------------------------------------------------------- +// Prototypes: +// ----------------------------------------------------------------------------- + +void SUClearLog( void ); +void SULog( NSString* format, ... ); + + diff --git a/SULog.m b/SULog.m new file mode 100644 index 00000000..b58235aa --- /dev/null +++ b/SULog.m @@ -0,0 +1,80 @@ +/* + * SULog.m + * EyeTV + * + * Created by Uli Kusterer on 12/03/2009. + * Copyright 2009 Elgato Systems GmbH. All rights reserved. + * + */ + +// ----------------------------------------------------------------------------- +// Headers: +// ----------------------------------------------------------------------------- + +#include "SULog.h" + + +// ----------------------------------------------------------------------------- +// Constants: +// ----------------------------------------------------------------------------- + +#define LOG_FILE_PATH @"~/Library/Logs/SparkleUpdateLog.log" + + +// ----------------------------------------------------------------------------- +// SUClearLog: +// Erase the log at the start of an update. We don't want to litter the +// user's hard disk with logging data that's mostly unused, so each app +// should clear the log before it starts updating, so only the most recent +// update is kept around. +// +// TAKES: +// sender - Object that sent this message, typically of type X. +// +// GIVES: +// param - who owns the returned value? +// result - same here. +// ----------------------------------------------------------------------------- + +void SUClearLog( void ) +{ + FILE* logfile = fopen([[LOG_FILE_PATH stringByExpandingTildeInPath] fileSystemRepresentation],"w"); + if( logfile ) + fclose(logfile); + else + NSLog(@"----- Sparkle Log -----"); +} + + +// ----------------------------------------------------------------------------- +// SULog: +// Like NSLog, but logs to one specific log file. Each line is prefixed +// with the current date and time, to help in regressing issues. +// +// TAKES: +// format - NSLog/printf-style format string. +// ... - More parameters depending on format string's contents. +// ----------------------------------------------------------------------------- + +void SULog( NSString* format, ... ) +{ + va_list ap; + va_start(ap, format); + NSString* theStr = [[[NSString alloc] initWithFormat: format arguments: ap] autorelease]; + FILE* logfile = fopen([[LOG_FILE_PATH stringByExpandingTildeInPath] fileSystemRepresentation],"a"); + if( !logfile ) + NSLog( @"%@",theStr ); + else + { + theStr = [NSString stringWithFormat: @"%@: %@", [NSDate date], theStr]; + NSData* theData = [theStr dataUsingEncoding: NSUTF8StringEncoding]; + char newlineChar = '\n'; + fwrite( [theData bytes], 1, [theData length], logfile ); + fwrite( &newlineChar, 1, 1, logfile ); // Append a newline. + fclose( logfile ); + logfile = NULL; + } + va_end(ap); +} + + diff --git a/SUPackageInstaller.h b/SUPackageInstaller.h index b31bc59d..5b69095f 100644 --- a/SUPackageInstaller.h +++ b/SUPackageInstaller.h @@ -9,7 +9,11 @@ #ifndef SUPACKAGEINSTALLER_H #define SUPACKAGEINSTALLER_H -#import "Sparkle.h" +#import "SUUpdater.h" + +#import "SUAppcast.h" +#import "SUAppcastItem.h" +#import "SUVersionComparisonProtocol.h" #import "SUPlainInstaller.h" @interface SUPackageInstaller : SUPlainInstaller { } diff --git a/SUPackageInstaller.m b/SUPackageInstaller.m index 93c26d98..7be44994 100644 --- a/SUPackageInstaller.m +++ b/SUPackageInstaller.m @@ -7,6 +7,7 @@ // #import "SUPackageInstaller.h" +#import #import "SUConstants.h" #ifndef NSAppKitVersionNumber10_4 diff --git a/SUPipedUnarchiver.m b/SUPipedUnarchiver.m index db7ffc99..c216f44c 100644 --- a/SUPipedUnarchiver.m +++ b/SUPipedUnarchiver.m @@ -8,6 +8,8 @@ #import "SUPipedUnarchiver.h" #import "SUUnarchiver_Private.h" +#import "SULog.h" + @implementation SUPipedUnarchiver @@ -18,7 +20,7 @@ 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; @@ -44,6 +46,10 @@ // This method abstracts the types that use a command line tool piping data from stdin. - (void)_extractArchivePipingDataToCommand:(NSString *)command { + // *** GETS CALLED ON NON-MAIN THREAD!!! + + SULog(@"Extracting %@ using '%@'",archivePath,command); + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; FILE *fp = NULL, *cmdFP = NULL; @@ -97,21 +103,29 @@ finally: - (void)_extractTAR { + // *** GETS CALLED ON NON-MAIN THREAD!!! + return [self _extractArchivePipingDataToCommand:@"tar -xC \"$DESTINATION\""]; } - (void)_extractTGZ { + // *** GETS CALLED ON NON-MAIN THREAD!!! + return [self _extractArchivePipingDataToCommand:@"tar -zxC \"$DESTINATION\""]; } - (void)_extractTBZ { + // *** GETS CALLED ON NON-MAIN THREAD!!! + return [self _extractArchivePipingDataToCommand:@"tar -jxC \"$DESTINATION\""]; } - (void)_extractZIP { + // *** GETS CALLED ON NON-MAIN THREAD!!! + return [self _extractArchivePipingDataToCommand:@"ditto -x -k - \"$DESTINATION\""]; } diff --git a/SUPlainInstaller.h b/SUPlainInstaller.h index 54747283..2172e82c 100644 --- a/SUPlainInstaller.h +++ b/SUPlainInstaller.h @@ -9,11 +9,16 @@ #ifndef SUPLAININSTALLER_H #define SUPLAININSTALLER_H -#import "Sparkle.h" +#import "SUUpdater.h" + +#import "SUAppcast.h" +#import "SUAppcastItem.h" +#import "SUVersionComparisonProtocol.h" #import "SUInstaller.h" #import "SUVersionComparisonProtocol.h" @class SUHost; + @interface SUPlainInstaller : SUInstaller { } + (void)performInstallationWithPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator; @end diff --git a/SUPlainInstaller.m b/SUPlainInstaller.m index 59f36a2d..5edce009 100644 --- a/SUPlainInstaller.m +++ b/SUPlainInstaller.m @@ -9,6 +9,8 @@ #import "SUPlainInstaller.h" #import "SUPlainInstallerInternals.h" #import "SUConstants.h" +#import "SUHost.h" + NSString *SUInstallerPathKey = @"SUInstallerPath"; NSString *SUInstallerTargetPathKey = @"SUInstallerTargetPath"; @@ -22,11 +24,15 @@ NSString *SUInstallerErrorKey = @"SUInstallerError"; + (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]]; } + (void)_performInstallationWithInfo:(NSDictionary *)info { + // *** GETS CALLED ON NON-MAIN THREAD! + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSError *error = nil; diff --git a/SUPlainInstallerInternals.m b/SUPlainInstallerInternals.m index dbe3ef92..3111e790 100644 --- a/SUPlainInstallerInternals.m +++ b/SUPlainInstallerInternals.m @@ -6,7 +6,11 @@ // Copyright 2006 Andy Matuschak. All rights reserved. // -#import "Sparkle.h" +#import "SUUpdater.h" + +#import "SUAppcast.h" +#import "SUAppcastItem.h" +#import "SUVersionComparisonProtocol.h" #import "SUPlainInstallerInternals.h" #import "SUConstants.h" @@ -16,6 +20,8 @@ #import #import #import +#import + @interface SUPlainInstaller (MMExtendedAttributes) // Removes the directory tree rooted at |root| from the file quarantine. @@ -43,6 +49,8 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authorization, const char* executablePath, AuthorizationFlags options, const char* const* arguments) { + // *** MUST BE SAFE TO CALL ON NON-MAIN THREAD! + sig_t oldSigChildHandler = signal(SIGCHLD, SIG_DFL); BOOL returnValue = YES; @@ -86,8 +94,67 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza return [tempDir lastPathComponent]; } ++ (NSString *)_temporaryCopyNameForPath:(NSString *)path didFindTrash: (BOOL*)outDidFindTrash +{ + // *** MUST BE SAFE TO CALL ON NON-MAIN THREAD! + NSString *tempDir = nil; + + UInt8 trashPath[MAXPATHLEN +1] = { 0 }; + FSRef trashRef, pathRef; + FSVolumeRefNum vSrcRefNum = kFSInvalidVolumeRefNum; + FSCatalogInfo catInfo = { 0 }; + OSStatus err = FSPathMakeRef( (UInt8*) [path fileSystemRepresentation], &pathRef, NULL ); + if( err == noErr ) + { + err = FSGetCatalogInfo( &pathRef, kFSCatInfoVolume, &catInfo, NULL, NULL, NULL ); + vSrcRefNum = catInfo.volume; + } + if( err == noErr ) + err = FSFindFolder( vSrcRefNum, kTrashFolderType, kCreateFolder, &trashRef ); + if( err == noErr ) + err = FSGetCatalogInfo( &trashRef, kFSCatInfoVolume, &catInfo, NULL, NULL, NULL ); + if( err == noErr && vSrcRefNum != catInfo.volume ) + err = nsvErr; // Couldn't find a trash folder on same volume as given path. Docs say this may happen in the future. + if( err == noErr ) + err = FSRefMakePath( &trashRef, trashPath, MAXPATHLEN ); + if( err == noErr ) + tempDir = [NSString stringWithUTF8String: (char*) trashPath]; + if( outDidFindTrash ) + *outDidFindTrash = (tempDir != nil); + if( !tempDir ) + tempDir = [path stringByDeletingLastPathComponent]; + + // Let's try to read the version number so the filename will be more meaningful. + NSString *postFix = nil; + NSString *version = nil; + if ((version = [[NSBundle bundleWithPath: path] objectForInfoDictionaryKey:@"CFBundleVersion"]) && ![version isEqualToString:@""]) + { + // We'll clean it up a little for safety. + // The cast is necessary because of a bug in the headers in pre-10.5 SDKs + NSMutableCharacterSet *validCharacters = (id)[NSMutableCharacterSet alphanumericCharacterSet]; + [validCharacters formUnionWithCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@".-()"]]; + postFix = [version stringByTrimmingCharactersInSet:[validCharacters invertedSet]]; + } + else + postFix = @"old"; + NSString *prefix = [NSString stringWithFormat: @"%@ (%@)", [[path lastPathComponent] stringByDeletingPathExtension], postFix]; + NSString *tempName = [prefix stringByAppendingPathExtension: [path pathExtension]]; + tempDir = [tempDir stringByAppendingPathComponent: tempName]; + + // Now let's make sure we get a unique path. + int cnt=2; + while ([[NSFileManager defaultManager] fileExistsAtPath:tempDir] && cnt <= 9999) + tempDir = [[tempDir stringByDeletingLastPathComponent] stringByAppendingPathComponent: [NSString stringWithFormat:@"%@ %d.%@", prefix, cnt++, [path pathExtension]]]; + + return tempDir; +} + + (BOOL)_copyPathWithForcedAuthentication:(NSString *)src toPath:(NSString *)dst temporaryPath:(NSString *)tmp error:(NSError **)error { + // *** MUST BE SAFE TO CALL ON NON-MAIN THREAD! + + //BOOL foundTrash = NO; // +++ Using trash as tmp folder to begin with would be way cooler, IMHO. + //NSString* tmp = [self _temporaryCopyNameForPath:dst didFindTrash: &foundTrash]; const char* srcPath = [src fileSystemRepresentation]; const char* tmpPath = [tmp fileSystemRepresentation]; const char* dstPath = [dst fileSystemRepresentation]; @@ -112,35 +179,35 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza snprintf(uidgid, sizeof(uidgid), "%d:%d", dstSB.st_uid, dstSB.st_gid); - const char* executables[] = { - "/bin/rm", - "/bin/mv", - "/bin/mv", - "/bin/rm", - NULL, // pause here and do some housekeeping before - // continuing - "/usr/sbin/chown", - NULL // stop here for real - }; + if( res ) // Set permissions while it's still in source, so we have it with working and correct perms when it arrives at destination. + { + const char* coParams[] = { "-R", uidgid, srcPath, NULL }; + res = AuthorizationExecuteWithPrivilegesAndWait( auth, "/usr/sbin/chown", kAuthorizationFlagDefaults, coParams ); + } - // 4 is the maximum number of arguments to any command, - // including the NULL that signals the end of an argument - // list. - const char* const argumentLists[][4] = { - { "-rf", tmpPath, NULL }, // make room for the temporary file... this is kinda unsafe; should probably do something better. - { "-f", dstPath, tmpPath, NULL }, // mv - { "-f", srcPath, dstPath, NULL }, // mv - { "-rf", tmpPath, NULL }, // rm - { NULL }, // pause - { "-R", uidgid, dstPath, NULL }, // chown - { NULL } // stop - }; + BOOL haveDst = [[NSFileManager defaultManager] fileExistsAtPath: dst]; + if( res && haveDst ) // If there's something at our tmp path (previous failed update or whatever) delete that first. + { + const char* rmParams[] = { "-rf", tmpPath, NULL }; + res = AuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams ); + } - // Process the commands up until the first NULL - int commandIndex = 0; - for (; executables[commandIndex] != NULL; ++commandIndex) { - if (res) - res = AuthorizationExecuteWithPrivilegesAndWait(auth, executables[commandIndex], kAuthorizationFlagDefaults, argumentLists[commandIndex]); + if( res && haveDst ) // Move old exe to tmp path. + { + const char* mvParams[] = { "-f", dstPath, tmpPath, NULL }; + res = AuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/mv", kAuthorizationFlagDefaults, mvParams ); + } + + if( res ) // Move new exe to old exe's path. + { + const char* mvParams2[] = { "-f", srcPath, dstPath, NULL }; + res = AuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/mv", kAuthorizationFlagDefaults, mvParams2 ); + } + + if( res && haveDst /*&& !foundTrash*/ ) // If we managed to put the old exe in the trash, leave it there for the user to delete or recover. + { // ... Otherwise we better delete it, wouldn't want dozens of old versions lying around next to the new one. + const char* rmParams2[] = { "-rf", tmpPath, NULL }; + res = AuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams2 ); } // If the currently-running application is trusted, the new @@ -159,15 +226,6 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza [self performSelectorOnMainThread:@selector(releaseFromQuarantine:) withObject:dst waitUntilDone:YES]; } - // Now move past the NULL we found and continue executing - // commands from the list. - ++commandIndex; - - for (; executables[commandIndex] != NULL; ++commandIndex) { - if (res) - res = AuthorizationExecuteWithPrivilegesAndWait(auth, executables[commandIndex], kAuthorizationFlagDefaults, argumentLists[commandIndex]); - } - AuthorizationFree(auth, 0); if (!res) @@ -269,6 +327,8 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza fromFile:(NSString*)file options:(int)options { + // *** MUST BE SAFE TO CALL ON NON-MAIN THREAD! + typedef int (*removexattr_type)(const char*, const char*, int); // Reference removexattr directly, it's in the SDK. static removexattr_type removexattr_func = removexattr; @@ -300,6 +360,8 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza + (void)releaseFromQuarantine:(NSString*)root { + // *** MUST BE SAFE TO CALL ON NON-MAIN THREAD! + const char* quarantineAttribute = "com.apple.quarantine"; const int removeXAttrOptions = XATTR_NOFOLLOW; diff --git a/SUScheduledUpdateDriver.m b/SUScheduledUpdateDriver.m index 2c92dc85..2d4b0750 100644 --- a/SUScheduledUpdateDriver.m +++ b/SUScheduledUpdateDriver.m @@ -7,7 +7,11 @@ // #import "SUScheduledUpdateDriver.h" -#import "Sparkle.h" +#import "SUUpdater.h" + +#import "SUAppcast.h" +#import "SUAppcastItem.h" +#import "SUVersionComparisonProtocol.h" @implementation SUScheduledUpdateDriver diff --git a/SUStandardVersionComparator.m b/SUStandardVersionComparator.m index 03c0c0d7..c2066a0c 100644 --- a/SUStandardVersionComparator.m +++ b/SUStandardVersionComparator.m @@ -6,7 +6,11 @@ // Copyright 2007 Andy Matuschak. All rights reserved. // -#import "Sparkle.h" +#import "SUUpdater.h" + +#import "SUAppcast.h" +#import "SUAppcastItem.h" +#import "SUVersionComparisonProtocol.h" #import "SUStandardVersionComparator.h" @implementation SUStandardVersionComparator @@ -22,15 +26,19 @@ typedef enum { kNumberType, kStringType, - kPeriodType + kSeparatorType, } SUCharacterType; - (SUCharacterType)typeOfCharacter:(NSString *)character { if ([character isEqualToString:@"."]) { - return kPeriodType; + return kSeparatorType; } else if ([[NSCharacterSet decimalDigitCharacterSet] characterIsMember:[character characterAtIndex:0]]) { return kNumberType; + } else if ([[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:[character characterAtIndex:0]]) { + return kSeparatorType; + } else if ([[NSCharacterSet punctuationCharacterSet] characterIsMember:[character characterAtIndex:0]]) { + return kSeparatorType; } else { return kStringType; } @@ -52,7 +60,7 @@ typedef enum { for (i = 1; i <= n; ++i) { character = [version substringWithRange:NSMakeRange(i, 1)]; newType = [self typeOfCharacter:character]; - if (oldType != newType || oldType == kPeriodType) { + if (oldType != newType || oldType == kSeparatorType) { // We've reached a new segment NSString *aPart = [[NSString alloc] initWithString:s]; [parts addObject:aPart]; diff --git a/SUStatus.nib/classes.nib b/SUStatus.nib/classes.nib new file mode 100644 index 00000000..22f13f8b --- /dev/null +++ b/SUStatus.nib/classes.nib @@ -0,0 +1,56 @@ + + + + + IBClasses + + + CLASS + SUWindowController + LANGUAGE + ObjC + SUPERCLASS + NSWindowController + + + CLASS + NSApplication + LANGUAGE + ObjC + SUPERCLASS + NSResponder + + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + CLASS + NSObject + LANGUAGE + ObjC + + + CLASS + SUStatusController + LANGUAGE + ObjC + OUTLETS + + actionButton + NSButton + progressBar + NSProgressIndicator + + SUPERCLASS + SUWindowController + + + IBVersion + 1 + + diff --git a/SUStatus.nib/info.nib b/SUStatus.nib/info.nib new file mode 100644 index 00000000..a9ac8673 --- /dev/null +++ b/SUStatus.nib/info.nib @@ -0,0 +1,20 @@ + + + + + IBFramework Version + 670 + IBLastKnownRelativeProjectPath + Sparkle.xcodeproj + IBOldestOS + 5 + IBOpenObjects + + 6 + + IBSystem Version + 10A96 + targetFramework + IBCocoaFramework + + diff --git a/SUStatusController.m b/SUStatusController.m index 16774c0a..3d0d7f7c 100644 --- a/SUStatusController.m +++ b/SUStatusController.m @@ -6,8 +6,14 @@ // Copyright 2006 Andy Matuschak. All rights reserved. // -#import "Sparkle.h" +#import "SUUpdater.h" + +#import "SUAppcast.h" +#import "SUAppcastItem.h" +#import "SUVersionComparisonProtocol.h" #import "SUStatusController.h" +#import "SUHost.h" + @implementation SUStatusController @@ -31,7 +37,7 @@ [super dealloc]; } -- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [host bundlePath]]; } +- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@, %@>", [self class], [host bundlePath], [host installationPath]]; } - (void)awakeFromNib { @@ -60,7 +66,7 @@ [self setStatusText:aStatusText]; } -- (void)setButtonTitle:(NSString *)aButtonTitle target:target action:(SEL)action isDefault:(BOOL)isDefault +- (void)setButtonTitle:(NSString *)aButtonTitle target: (id)target action:(SEL)action isDefault:(BOOL)isDefault { [self willChangeValueForKey:@"buttonTitle"]; if (buttonTitle != aButtonTitle) @@ -82,6 +88,9 @@ [actionButton setTarget:target]; [actionButton setAction:action]; [actionButton setKeyEquivalent:isDefault ? @"\r" : @""]; + + // 06/05/2008 Alex: Avoid a crash when cancelling during the extraction + [self setButtonEnabled:(target != NULL)]; } - (BOOL)progressBarShouldAnimate diff --git a/SUSystemProfiler.h b/SUSystemProfiler.h index 6238e39c..0835087d 100644 --- a/SUSystemProfiler.h +++ b/SUSystemProfiler.h @@ -9,6 +9,8 @@ #ifndef SUSYSTEMPROFILER_H #define SUSYSTEMPROFILER_H +#import + @class SUHost; @interface SUSystemProfiler : NSObject {} + (SUSystemProfiler *)sharedSystemProfiler; diff --git a/SUUIBasedUpdateDriver.h b/SUUIBasedUpdateDriver.h index 09a96472..1d1d478e 100644 --- a/SUUIBasedUpdateDriver.h +++ b/SUUIBasedUpdateDriver.h @@ -13,7 +13,9 @@ #import "SUBasicUpdateDriver.h" @class SUStatusController, SUUpdateAlert; -@interface SUUIBasedUpdateDriver : SUBasicUpdateDriver { + +@interface SUUIBasedUpdateDriver : SUBasicUpdateDriver +{ SUStatusController *statusController; SUUpdateAlert *updateAlert; } diff --git a/SUUIBasedUpdateDriver.m b/SUUIBasedUpdateDriver.m index 3fe001ed..132797b9 100644 --- a/SUUIBasedUpdateDriver.m +++ b/SUUIBasedUpdateDriver.m @@ -11,6 +11,7 @@ #import "SUUpdateAlert.h" #import "SUHost.h" #import "SUStatusController.h" +#import "SUConstants.h" @implementation SUUIBasedUpdateDriver @@ -66,9 +67,17 @@ [statusController showWindow:self]; [self downloadUpdate]; break; - + + case SUOpenInfoURLChoice: + [[NSWorkspace sharedWorkspace] openURL: [updateItem infoURL]]; + [self abortUpdate]; + break; + case SUSkipThisVersionChoice: [host setObject:[updateItem versionString] forUserDefaultsKey:SUSkippedVersionKey]; + [self abortUpdate]; + break; + case SURemindMeLaterChoice: [self abortUpdate]; break; @@ -80,6 +89,7 @@ [statusController setMaxProgressValue:[response expectedContentLength]]; } + - (NSString *)_humanReadableSizeFromDouble:(double)value { if (value < 1024) @@ -139,7 +149,11 @@ [NSApp requestUserAttention:NSInformationalRequest]; } -- (void)installAndRestart:sender { [self installUpdate]; } +- (void)installAndRestart: (id)sender +{ + if( [updater mayUpdateAndRestart] ) + [self installUpdate]; +} - (void)installUpdate { diff --git a/SUUnarchiver.m b/SUUnarchiver.m index 03cfaac0..3c4a803e 100644 --- a/SUUnarchiver.m +++ b/SUUnarchiver.m @@ -7,7 +7,11 @@ // -#import "Sparkle.h" +#import "SUUpdater.h" + +#import "SUAppcast.h" +#import "SUAppcastItem.h" +#import "SUVersionComparisonProtocol.h" #import "SUUnarchiver.h" #import "SUUnarchiver_Private.h" diff --git a/SUUpdateAlert.h b/SUUpdateAlert.h index 1602b4a6..5530c75a 100644 --- a/SUUpdateAlert.h +++ b/SUUpdateAlert.h @@ -15,7 +15,8 @@ typedef enum { SUInstallUpdateChoice, SURemindMeLaterChoice, - SUSkipThisVersionChoice + SUSkipThisVersionChoice, + SUOpenInfoURLChoice } SUUpdateAlertChoice; @class WebView, SUAppcastItem, SUHost; @@ -26,6 +27,7 @@ typedef enum IBOutlet WebView *releaseNotesView; IBOutlet NSTextField *description; + IBOutlet NSButton *installButton; // UK 2007-08-31. NSProgressIndicator *releaseNotesSpinner; BOOL webViewFinishedLoading; } @@ -41,6 +43,7 @@ typedef enum @interface NSObject (SUUpdateAlertDelegate) - (void)updateAlert:(SUUpdateAlert *)updateAlert finishedWithChoice:(SUUpdateAlertChoice)updateChoice; +- (void)updateAlert:(SUUpdateAlert *)updateAlert shouldAllowAutoUpdate: (BOOL*)shouldAllowAutoUpdate; @end #endif diff --git a/SUUpdateAlert.m b/SUUpdateAlert.m index 08fa2792..38b8d6e9 100644 --- a/SUUpdateAlert.m +++ b/SUUpdateAlert.m @@ -6,11 +6,25 @@ // Copyright 2006 Andy Matuschak. All rights reserved. // +// ----------------------------------------------------------------------------- +// Headers: +// ----------------------------------------------------------------------------- + #import "SUUpdateAlert.h" #import "SUHost.h" #import +#import "SUConstants.h" + + +@interface WebView (SUTenFiveProperty) + +-(void) setDrawsBackground: (BOOL)state; + +@end + + @implementation SUUpdateAlert - (id)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost @@ -50,6 +64,11 @@ [self endWithSelection:SUInstallUpdateChoice]; } +- (IBAction)openInfoURL:sender +{ + [self endWithSelection:SUOpenInfoURLChoice]; +} + - (IBAction)skipThisVersion:sender { [self endWithSelection:SUSkipThisVersionChoice]; @@ -99,26 +118,40 @@ { NSNumber *shouldShowReleaseNotes = [host objectForInfoDictionaryKey:SUShowReleaseNotesKey]; if (shouldShowReleaseNotes == nil) - return YES; // defaults to YES + { + // UK 2007-09-18: Don't show release notes if RSS item contains no description and no release notes URL: + return( ([updateItem itemDescription] != nil + && [[[updateItem itemDescription] stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]] length] > 0) + || [updateItem releaseNotesURL] != nil ); + } else return [shouldShowReleaseNotes boolValue]; } - (BOOL)allowsAutomaticUpdates { - if (![host objectForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey]) - return YES; // defaults to YES - return [host boolForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey]; + BOOL allowAutoUpdates = YES; // Defaults to YES. + if( [host objectForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey] ) + allowAutoUpdates = [host boolForInfoDictionaryKey: SUAllowsAutomaticUpdatesKey]; + + // UK 2007-08-31: Give delegate a chance to modify this choice: + if( delegate && [delegate respondsToSelector: @selector(updateAlert:shouldAllowAutoUpdate:)] ) + [delegate updateAlert: self shouldAllowAutoUpdate: &allowAutoUpdates]; + + return allowAutoUpdates; } - (void)awakeFromNib { - [[self window] setLevel:NSFloatingWindowLevel]; + NSString* sizeStr = [host objectForInfoDictionaryKey:SUFixedHTMLDisplaySizeKey]; + + //[[self window] setLevel:NSFloatingWindowLevel]; // This means the window will float over all other apps, if our app is switched out ?! UK 2007-09-04 + [[self window] setFrameAutosaveName: sizeStr ? @"" : @"SUUpdateAlertFrame"]; // We're gonna do some frame magic to match the window's size to the description field and the presence of the release notes view. - NSRect frame = [[self window] frame]; - - if (![self showsReleaseNotes]) + NSRect frame = [[self window] frame]; + BOOL showReleaseNotes = [self showsReleaseNotes]; // UK 2007-09-18 + if (!showReleaseNotes) // UK 2007-09-18 { // Resize the window to be appropriate for not having a huge release notes view. frame.size.height -= [releaseNotesView frame].size.height + 40; // Extra 40 is for the release notes label and margin. @@ -133,15 +166,52 @@ [[[releaseNotesView superview] superview] setFrame:boxFrame]; } + if( showReleaseNotes ) // UK 2007-09-18 (whole block) + { + if( sizeStr ) + { + NSSize desiredSize = NSSizeFromString( sizeStr ); + NSSize sizeDiff = NSZeroSize; + NSBox* boxView = (NSBox*)[[releaseNotesView superview] superview]; + + //[boxView setBorderType: NSNoBorder]; + [releaseNotesView setDrawsBackground: NO]; + + sizeDiff.width = desiredSize.width -[releaseNotesView frame].size.width; + sizeDiff.height = desiredSize.height -[releaseNotesView frame].size.height; + frame.size.width += sizeDiff.width; + frame.size.height += sizeDiff.height; + + // No resizing: + [[self window] setShowsResizeIndicator:NO]; + [[self window] setMinSize:frame.size]; + [[self window] setMaxSize:frame.size]; + } + } + [[self window] setFrame:frame display:NO]; [[self window] center]; - if ([self showsReleaseNotes]) + if (showReleaseNotes) // UK 2007-09-18 { [self displayReleaseNotes]; } + + [[[releaseNotesView superview] superview] setHidden: !showReleaseNotes]; // UK 2007-09-18 + + if( [updateItem fileURL] == nil ) // UK 2007-08-31 (whole if clause) + { + [installButton setTitle: SULocalizedString( @"Learn More...", @"Alternate title for 'Install Update' button." )]; + [installButton setAction: @selector(openInfoURL:)]; + } } +-(BOOL)showsReleaseNotesText +{ + return( [host objectForInfoDictionaryKey:SUFixedHTMLDisplaySizeKey] == nil ); +} + + - (BOOL)windowShouldClose:note { [self endWithSelection:SURemindMeLaterChoice]; diff --git a/SUUpdateDriver.m b/SUUpdateDriver.m index a3ccdd32..66b5880f 100644 --- a/SUUpdateDriver.m +++ b/SUUpdateDriver.m @@ -7,6 +7,7 @@ // #import "SUUpdateDriver.h" +#import "SUHost.h" NSString *SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished"; @@ -18,7 +19,7 @@ NSString *SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished"; return self; } -- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [host bundlePath]]; } +- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@, %@>", [self class], [host bundlePath], [host installationPath]]; } - (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)h { diff --git a/SUUpdatePermissionPrompt.m b/SUUpdatePermissionPrompt.m index a6277a50..0a4106fc 100644 --- a/SUUpdatePermissionPrompt.m +++ b/SUUpdatePermissionPrompt.m @@ -9,6 +9,7 @@ #import "SUUpdatePermissionPrompt.h" #import "SUHost.h" +#import "SUConstants.h" @implementation SUUpdatePermissionPrompt diff --git a/SUUpdater.h b/SUUpdater.h index 0ed3a2d4..140e4fad 100644 --- a/SUUpdater.h +++ b/SUUpdater.h @@ -9,7 +9,7 @@ #ifndef SUUPDATER_H #define SUUPDATER_H -#import +#import "SUVersionComparisonProtocol.h" @class SUUpdateDriver, SUAppcastItem, SUHost, SUAppcast; @interface SUUpdater : NSObject { @@ -37,7 +37,7 @@ - (NSTimeInterval)updateCheckInterval; - (void)setFeedURL:(NSURL *)feedURL; -- (NSURL *)feedURL; +- (NSURL *)feedURL; // *** MUST BE CALLED ON MAIN THREAD *** - (void)setUserAgentString:(NSString *)userAgent; - (NSString *)userAgentString; @@ -50,7 +50,7 @@ // This IBAction is meant for a main menu item. Hook up any menu item to this action, // and Sparkle will check for updates and report back its findings verbosely. -- (IBAction)checkForUpdates:sender; +- (IBAction)checkForUpdates:(id)sender; // This kicks off an update meant to be programmatically initiated. That is, it will display no UI unless it actually finds an update, // in which case it proceeds as usual. If the fully automated updating is turned on, however, this will invoke that behavior, and if an @@ -68,12 +68,22 @@ - (void)resetUpdateCycle; - (BOOL)updateInProgress; + +-(BOOL) mayUpdateAndRestart; // If we can't restart, don't update, because that'd mean anything the old app (still running) reads from disk + @end @interface NSObject (SUUpdaterDelegateInformalProtocol) + +// Use this to keep Sparkle from popping up e.g. while your setup assistant is showing: +- (BOOL)updaterMayCheckForUpdates:(SUUpdater *)bundle; + // This method allows you to add extra parameters to the appcast URL, potentially based on whether or not Sparkle will also be sending along the system profile. This method should return an array of dictionaries with keys: "key", "value", "displayKey", "displayValue", the latter two being specifically for display to the user. - (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile; +// If you need to generate the whole URL: +-(NSString*) feedURLStringForUpdater: (SUUpdater*)updater; + // Use this to override the default behavior for Sparkle prompting the user about automatic update checks. - (BOOL)updaterShouldPromptForPermissionToCheckForUpdates:(SUUpdater *)bundle; @@ -94,8 +104,14 @@ - (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update; // Return YES to delay the relaunch until you do some processing; invoke the given NSInvocation to continue. +// This is not called if the user didn't relaunch on the previous update, in that case it will immediately +// restart. - (BOOL)updater:(SUUpdater *)updater shouldPostponeRelaunchForUpdate:(SUAppcastItem *)update untilInvoking:(NSInvocation *)invocation; +// Some apps *can not* be relaunched in certain circumstances. They can use this method +// to prevent a relaunch "hard": +- (BOOL)updaterShouldRelaunchApplication:(SUUpdater *)updater; + // Called immediately before relaunching. - (void)updaterWillRelaunchApplication:(SUUpdater *)updater; @@ -109,13 +125,13 @@ @end // Define some minimum intervals to avoid DOS-like checking attacks. These are in seconds. -#ifdef DEBUG +#ifdef DEBUG && 0 #define SU_MIN_CHECK_INTERVAL 60 #else #define SU_MIN_CHECK_INTERVAL 60*60 #endif -#ifdef DEBUG +#ifdef DEBUG && 0 #define SU_DEFAULT_CHECK_INTERVAL 60 #else #define SU_DEFAULT_CHECK_INTERVAL 60*60*24 diff --git a/SUUpdater.m b/SUUpdater.m index 16291250..acc490e6 100644 --- a/SUUpdater.m +++ b/SUUpdater.m @@ -15,9 +15,13 @@ #import "SUProbingUpdateDriver.h" #import "SUUserInitiatedUpdateDriver.h" #import "SUScheduledUpdateDriver.h" +#import "SUConstants.h" +#import "SULog.h" +#include // UK 2007-04-27 + @interface SUUpdater (Private) -- initForBundle:(NSBundle *)bundle; +- (id)initForBundle:(NSBundle *)bundle; - (void)startUpdateCycle; - (void)checkForUpdatesWithDriver:(SUUpdateDriver *)updateDriver; - (BOOL)automaticallyDownloadsUpdates; @@ -25,7 +29,6 @@ - (void)registerAsObserver; - (void)unregisterAsObserver; - (void)updateDriverDidFinish:(NSNotification *)note; -- initForBundle:(NSBundle *)bundle; - (NSURL *)parameterizedFeedURL; @end @@ -52,7 +55,7 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv } // This is the designated initializer for SUUpdater, important for subclasses -- initForBundle:(NSBundle *)bundle +- (id)initForBundle:(NSBundle *)bundle { self = [super init]; if (bundle == nil) bundle = [NSBundle mainBundle]; @@ -70,10 +73,11 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv host = [[SUHost alloc] initWithBundle:bundle]; [self registerAsObserver]; +#if 0 // Saving-the-developer-from-a-stupid-mistake-check: if (![[[self feedURL] scheme] isEqualToString:@"https"] && ![host publicDSAKey]) NSRunAlertPanel(@"Insecure update error!", @"For security reasons, you need to distribute your appcast over SSL or sign your updates. See Sparkle's documentation for more information.", @"OK", nil, nil); - +#endif // This runs the permission prompt if needed, but never before the app has finished launching because the runloop won't run before that [self performSelector:@selector(startUpdateCycle) withObject:nil afterDelay:0]; } @@ -86,7 +90,7 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv return [self initForBundle:[NSBundle mainBundle]]; } -- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [host bundlePath]]; } +- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@, %@>", [self class], [host bundlePath], [host installationPath]]; } - (void)startUpdateCycle { @@ -157,6 +161,7 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv if (checkTimer) { [checkTimer invalidate]; + [checkTimer release]; // UK 2009-03-16 Timer is non-repeating, may have invalidated itself, so we had to retain it. checkTimer = nil; } if (![self automaticallyChecksForUpdates]) return; @@ -174,17 +179,79 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv delayUntilCheck = (updateCheckInterval - intervalSinceCheck); // It hasn't been long enough. else delayUntilCheck = 0; // We're overdue! Run one now. - checkTimer = [NSTimer scheduledTimerWithTimeInterval:delayUntilCheck target:self selector:@selector(checkForUpdatesInBackground) userInfo:nil repeats:NO]; + checkTimer = [[NSTimer scheduledTimerWithTimeInterval:delayUntilCheck target:self selector:@selector(checkForUpdatesInBackground) userInfo:nil repeats:NO] retain]; // UK 2009-03-16 Timer is non-repeating, may have invalidated itself, so we had to retain it. } + +-(void) putFeedURLIntoDictionary: (NSMutableDictionary*)theDict // You release this. +{ + [theDict setObject: [self feedURL] forKey: @"feedURL"]; +} + +-(void) checkForUpdatesInBgReachabilityCheckWithDriver: (SUUpdateDriver*)inDriver /* RUNS ON ITS OWN THREAD */ +{ + NS_DURING + // This method *must* be called on its own thread. SCNetworkReachabilityCheckByName + // can block, and it can be waiting a long time on slow networks, and we + // wouldn't want to beachball the main thread for a background operation. + // We could use asynchronous reachability callbacks, but those aren't + // reliable enough and can 'get lost' sometimes, which we don't want. + + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + SCNetworkConnectionFlags flags = 0; + BOOL isNetworkReachable = YES; + + // Don't perform automatic checks on unconnected laptops or dial-up connections that aren't online: + NSMutableDictionary* theDict = [NSMutableDictionary dictionary]; + [self performSelectorOnMainThread: @selector(putFeedURLIntoDictionary:) withObject: theDict waitUntilDone: YES]; // Get feed URL on main thread, it's not safe to call elsewhere. + if( SCNetworkCheckReachabilityByName( [[[theDict objectForKey: @"feedURL"] host] cStringUsingEncoding: NSUTF8StringEncoding], &flags ) ) + { + BOOL reachable = (flags & kSCNetworkFlagsReachable) == kSCNetworkFlagsReachable; + BOOL automatic = (flags & kSCNetworkFlagsConnectionAutomatic) == kSCNetworkFlagsConnectionAutomatic; + BOOL local = (flags & kSCNetworkFlagsIsLocalAddress) == kSCNetworkFlagsIsLocalAddress; + + //NSLog(@"reachable = %s, automatic = %s, local = %s", (reachable?"YES":"NO"), (automatic?"YES":"NO"), (local?"YES":"NO")); + + if( !(reachable || automatic || local) ) + isNetworkReachable = NO; + } + + if( isNetworkReachable ) + { + [self performSelectorOnMainThread: @selector(checkForUpdatesWithDriver:) withObject: inDriver waitUntilDone: NO]; + } + + [pool release]; + NS_HANDLER + NSLog(@"UNCAUGHT EXCEPTION IN UPDATE CHECK TIMER: %@",[localException reason]); + // Don't propagate the exception beyond here. In Carbon apps that would trash the stack. + NS_ENDHANDLER +} + + - (void)checkForUpdatesInBackground { - checkTimer = nil; // Timer doesn't repeat, so it's invalid, just needs to be set to nil. + if( [delegate respondsToSelector: @selector(updaterMayCheckForUpdates:)] && ![delegate updaterMayCheckForUpdates: self] ) + { + [self scheduleNextUpdateCheck]; + return; + } - [self checkForUpdatesWithDriver:[[[([self automaticallyDownloadsUpdates] ? [SUAutomaticUpdateDriver class] : [SUScheduledUpdateDriver class]) alloc] initWithUpdater:self] autorelease]]; + // Background update checks should only happen if we have a network connection. + // Wouldn't want to annoy users on dial-up by establishing a connection every + // hour or so: + SUUpdateDriver * theUpdateDriver = [[[([self automaticallyDownloadsUpdates] ? [SUAutomaticUpdateDriver class] : [SUScheduledUpdateDriver class]) alloc] initWithUpdater:self] autorelease]; + + [NSThread detachNewThreadSelector: @selector(checkForUpdatesInBgReachabilityCheckWithDriver:) toTarget: self withObject: theUpdateDriver]; } -- (IBAction)checkForUpdates:sender + +-(BOOL) mayUpdateAndRestart +{ + return( !delegate || ![delegate respondsToSelector: @selector(updaterShouldRelaunchApplication:)] || [delegate updaterShouldRelaunchApplication: self] ); +} + +- (IBAction)checkForUpdates: (id)sender { [self checkForUpdatesWithDriver:[[[SUUserInitiatedUpdateDriver alloc] initWithUpdater:self] autorelease]]; } @@ -197,14 +264,21 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv - (void)checkForUpdatesWithDriver:(SUUpdateDriver *)d { if ([self updateInProgress]) { return; } - if (checkTimer) { [checkTimer invalidate]; checkTimer = nil; } + if (checkTimer) { [checkTimer invalidate]; [checkTimer release]; checkTimer = nil; } // UK 2009-03-16 Timer is non-repeating, may have invalidated itself, so we had to retain it. + + SUClearLog(); + SULog( @"===== %@ =====", [[NSFileManager defaultManager] displayNameAtPath: [[NSBundle mainBundle] bundlePath]] ); [self willChangeValueForKey:@"lastUpdateCheckDate"]; [host setObject:[NSDate date] forUserDefaultsKey:SULastCheckTimeKey]; [self didChangeValueForKey:@"lastUpdateCheckDate"]; driver = [d retain]; - [driver checkForUpdatesAtURL:[self parameterizedFeedURL] host:host]; + NSURL* theFeedURL = [self parameterizedFeedURL]; + if( theFeedURL ) // Use a NIL URL to cancel quietly. + [driver checkForUpdatesAtURL: theFeedURL host:host]; + else + [driver abortUpdate]; } - (void)registerAsObserver @@ -289,14 +363,20 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv [host setObject:[feedURL absoluteString] forUserDefaultsKey:SUFeedURLKey]; } -- (NSURL *)feedURL +- (NSURL *)feedURL // *** MUST BE CALLED ON MAIN THREAD *** { // A value in the user defaults overrides one in the Info.plist (so preferences panels can be created wherein users choose between beta / release feeds). NSString *appcastString = [host objectForKey:SUFeedURLKey]; + if( [delegate respondsToSelector: @selector(feedURLStringForUpdater:)] ) + appcastString = [delegate feedURLStringForUpdater: self]; if (!appcastString) // Can't find an appcast string! [NSException raise:@"SUNoFeedURL" format:@"You must specify the URL of the appcast as the SUFeedURL key in either the Info.plist or the user defaults!"]; NSCharacterSet* quoteSet = [NSCharacterSet characterSetWithCharactersInString: @"\"\'"]; // Some feed publishers add quotes; strip 'em. - return [NSURL URLWithString:[appcastString stringByTrimmingCharactersInSet:quoteSet]]; + NSString* castUrlStr = [appcastString stringByTrimmingCharactersInSet:quoteSet]; + if( !castUrlStr || [castUrlStr length] == 0 ) + return nil; + else + return [NSURL URLWithString: castUrlStr]; } - (void)setUserAgentString:(NSString *)userAgent @@ -393,7 +473,7 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv { [self unregisterAsObserver]; [host release]; - if (checkTimer) { [checkTimer invalidate]; } + if (checkTimer) { [checkTimer invalidate]; [checkTimer release]; checkTimer = nil; } // UK 2009-03-16 Timer is non-repeating, may have invalidated itself, so we had to retain it. [super dealloc]; } diff --git a/SUVersionComparisonProtocol.h b/SUVersionComparisonProtocol.h index 3d11ae87..6c65ea45 100644 --- a/SUVersionComparisonProtocol.h +++ b/SUVersionComparisonProtocol.h @@ -9,6 +9,8 @@ #ifndef SUVERSIONCOMPARISONPROTOCOL_H #define SUVERSIONCOMPARISONPROTOCOL_H +#import + /*! @protocol @abstract Implement this protocol to provide version comparison facilities for Sparkle. @@ -20,7 +22,7 @@ @abstract An abstract method to compare two version strings. @discussion Should return NSOrderedAscending if b > a, NSOrderedDescending if b < a, and NSOrderedSame if they are equivalent. */ -- (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB; +- (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB; // *** MAY BE CALLED ON NON-MAIN THREAD! @end diff --git a/Sparkle.xcodeproj/default.pbxuser b/Sparkle.xcodeproj/default.pbxuser deleted file mode 100644 index 1bddcecd..00000000 --- a/Sparkle.xcodeproj/default.pbxuser +++ /dev/null @@ -1,245 +0,0 @@ -// !$*UTF8*$! -{ - 0867D690FE84028FC02AAC07 /* Project object */ = { - activeArchitecture = i386; - activeBuildConfigurationName = Debug; - activeExecutable = FAEC981A0D94C8750008EDA9 /* Sparkle Test App */; - activeTarget = 61B5F90109C4CEE200B25A18 /* Sparkle Test App */; - codeSenseManager = FAEC98240D94C8760008EDA9 /* Code sense */; - executables = ( - FAEC981A0D94C8750008EDA9 /* Sparkle Test App */, - FAEC981B0D94C8750008EDA9 /* Relaunch Tool */, - ); - perUserDictionary = { - PBXPerProjectTemplateStateSaveDate = 227854453; - PBXWorkspaceStateSaveDate = 227854453; - }; - sourceControlManager = FAEC98230D94C8760008EDA9 /* Source Control */; - userBuildSettings = { - }; - }; - 61B5F90109C4CEE200B25A18 /* Sparkle Test App */ = { - activeExec = 0; - executables = ( - FAEC981A0D94C8750008EDA9 /* Sparkle Test App */, - ); - }; - 8DC2EF4F0486A6940098B216 /* Sparkle */ = { - activeExec = 0; - }; - D1E42C2E0CE754AE00F50EB9 /* Relaunch Tool */ = { - activeExec = 0; - executables = ( - FAEC981B0D94C8750008EDA9 /* Relaunch Tool */, - ); - }; - FAEC981A0D94C8750008EDA9 /* Sparkle Test App */ = { - isa = PBXExecutable; - activeArgIndices = ( - ); - argumentStrings = ( - ); - autoAttachOnCrash = 1; - breakpointsEnabled = 1; - configStateDict = { - }; - customDataFormattersEnabled = 1; - debuggerPlugin = GDBDebugging; - disassemblyDisplayState = 0; - dylibVariantSuffix = ""; - enableDebugStr = 1; - environmentEntries = ( - { - active = YES; - name = MallocPreScribble; - value = 1; - }, - { - active = YES; - name = MallocScribble; - value = 1; - }, - { - active = YES; - name = MallocGuardEdges; - value = 1; - }, - { - active = YES; - name = MallocCheckHeapStart; - value = 1; - }, - { - active = YES; - name = MallocCheckHeapEach; - value = 100000; - }, - { - active = YES; - name = MallocStackLogging; - value = 1; - }, - { - active = NO; - name = MallocStackLoggingNoCompact; - value = 1; - }, - { - active = YES; - name = NSDebugEnabled; - value = YES; - }, - { - active = YES; - name = NSZombieEnabled; - value = YES; - }, - { - active = NO; - name = NSDeallocateZombies; - value = NO; - }, - { - active = YES; - name = NSAutoreleaseFreedObjectCheckEnabled; - value = YES; - }, - { - active = NO; - name = MALLOC_PROTECT_BEFORE; - value = 1; - }, - { - active = YES; - name = MALLOC_ALTIVEC_SIZE; - value = 1; - }, - { - active = YES; - name = MALLOC_FILL_SPACE; - value = 1; - }, - { - active = NO; - name = CFZombieLevel; - value = 65553; - }, - ); - executableSystemSymbolLevel = 0; - executableUserSymbolLevel = 0; - libgmallocEnabled = 0; - name = "Sparkle Test App"; - sourceDirectories = ( - ); - }; - FAEC981B0D94C8750008EDA9 /* Relaunch Tool */ = { - isa = PBXExecutable; - activeArgIndices = ( - ); - argumentStrings = ( - ); - autoAttachOnCrash = 1; - breakpointsEnabled = 1; - configStateDict = { - }; - customDataFormattersEnabled = 1; - debuggerPlugin = GDBDebugging; - disassemblyDisplayState = 0; - dylibVariantSuffix = ""; - enableDebugStr = 1; - environmentEntries = ( - { - active = YES; - name = MallocPreScribble; - value = 1; - }, - { - active = YES; - name = MallocScribble; - value = 1; - }, - { - active = YES; - name = MallocGuardEdges; - value = 1; - }, - { - active = YES; - name = MallocCheckHeapStart; - value = 1; - }, - { - active = YES; - name = MallocCheckHeapEach; - value = 100000; - }, - { - active = YES; - name = MallocStackLogging; - value = 1; - }, - { - active = NO; - name = MallocStackLoggingNoCompact; - value = 1; - }, - { - active = YES; - name = NSDebugEnabled; - value = YES; - }, - { - active = YES; - name = NSZombieEnabled; - value = YES; - }, - { - active = NO; - name = NSDeallocateZombies; - value = NO; - }, - { - active = YES; - name = NSAutoreleaseFreedObjectCheckEnabled; - value = YES; - }, - { - active = NO; - name = MALLOC_PROTECT_BEFORE; - value = 1; - }, - { - active = YES; - name = MALLOC_ALTIVEC_SIZE; - value = 1; - }, - { - active = YES; - name = MALLOC_FILL_SPACE; - value = 1; - }, - { - active = NO; - name = CFZombieLevel; - value = 65553; - }, - ); - executableSystemSymbolLevel = 0; - executableUserSymbolLevel = 0; - libgmallocEnabled = 0; - name = "Relaunch Tool"; - sourceDirectories = ( - ); - }; - FAEC98230D94C8760008EDA9 /* Source Control */ = { - isa = PBXSourceControlManager; - fallbackIsa = XCSourceControlManager; - isSCMEnabled = 0; - scmConfiguration = { - }; - }; - FAEC98240D94C8760008EDA9 /* Code sense */ = { - isa = PBXCodeSenseManager; - indexTemplatePath = ""; - }; -} diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 29559a29..4036b4b8 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -16,6 +16,11 @@ 552B69F010C0791800050E82 /* SUPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5210DAE8E8A0026945C /* SUPackageInstaller.m */; }; 552B6A3710C0795600050E82 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; }; 552B6A5E10C07FC200050E82 /* SUStandardVersionComparator.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A225A30D1C4AC000430CCD /* SUStandardVersionComparator.m */; }; + 55D8F80910C58B210011E7FA /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D8F80810C58B210011E7FA /* SULog.m */; }; + 55D8F80A10C58B210011E7FA /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D8F80810C58B210011E7FA /* SULog.m */; }; + 55D8F80B10C58B210011E7FA /* SULog.h in Headers */ = {isa = PBXBuildFile; fileRef = 55D8F80710C58B210011E7FA /* SULog.h */; }; + 55D8F80C10C58B210011E7FA /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D8F80810C58B210011E7FA /* SULog.m */; }; + 55D8F80D10C58B210011E7FA /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D8F80810C58B210011E7FA /* SULog.m */; }; 610134730DD250470049ACDF /* SUUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 610134710DD250470049ACDF /* SUUpdateDriver.h */; settings = {ATTRIBUTES = (); }; }; 610134740DD250470049ACDF /* SUUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 610134720DD250470049ACDF /* SUUpdateDriver.m */; }; 6101347B0DD2541A0049ACDF /* SUProbingUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 610134790DD2541A0049ACDF /* SUProbingUpdateDriver.h */; settings = {ATTRIBUTES = (); }; }; @@ -154,6 +159,9 @@ /* Begin PBXFileReference section */ 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 55D8F80410C589F40011E7FA /* ThreadSafePreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadSafePreferences.h; path = Elgato/ThreadSafePreferences.h; sourceTree = ""; }; + 55D8F80710C58B210011E7FA /* SULog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SULog.h; sourceTree = ""; }; + 55D8F80810C58B210011E7FA /* SULog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SULog.m; sourceTree = ""; }; 610134710DD250470049ACDF /* SUUpdateDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdateDriver.h; sourceTree = ""; }; 610134720DD250470049ACDF /* SUUpdateDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdateDriver.m; sourceTree = ""; }; 610134790DD2541A0049ACDF /* SUProbingUpdateDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUProbingUpdateDriver.h; sourceTree = ""; }; @@ -374,6 +382,9 @@ 0867D691FE84028FC02AAC07 /* Sparkle */ = { isa = PBXGroup; children = ( + 55D8F80410C589F40011E7FA /* ThreadSafePreferences.h */, + 55D8F80710C58B210011E7FA /* SULog.h */, + 55D8F80810C58B210011E7FA /* SULog.m */, 61F83F6E0DBFE07A006FDD30 /* Update Control */, 61299B3909CB055000B7442F /* Appcast Support */, 618FA6DB0DB485440026945C /* Installation */, @@ -630,6 +641,7 @@ 6102FE5B0E08C7EC00F85D09 /* SUUnarchiver_Private.h in Headers */, 61EF67590E25C5B400F754E0 /* SUHost.h in Headers */, 61CFB3290E385186007A1735 /* Sparkle.pch in Headers */, + 55D8F80B10C58B210011E7FA /* SULog.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -872,6 +884,7 @@ buildActionMask = 2147483647; files = ( 61227A160DB548B800AB99EA /* SUVersionComparisonTest.m in Sources */, + 55D8F80D10C58B210011E7FA /* SULog.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -880,6 +893,7 @@ buildActionMask = 2147483647; files = ( 61B5F93009C4CFDC00B25A18 /* main.m in Sources */, + 55D8F80A10C58B210011E7FA /* SULog.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -916,6 +930,7 @@ 6102FE5C0E08C7EC00F85D09 /* SUUnarchiver_Private.m in Sources */, 61D85D6D0E10B2ED00F9B4A9 /* SUPipedUnarchiver.m in Sources */, 61EF67560E25B58D00F754E0 /* SUHost.m in Sources */, + 55D8F80C10C58B210011E7FA /* SULog.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -932,6 +947,7 @@ 552B69ED10C0791000050E82 /* SUSystemProfiler.m in Sources */, 552B69F010C0791800050E82 /* SUPackageInstaller.m in Sources */, 552B6A5E10C07FC200050E82 /* SUStandardVersionComparator.m in Sources */, + 55D8F80910C58B210011E7FA /* SULog.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1127,6 +1143,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = FA1941D40D94A70100DD942E /* ConfigRelaunchRelease.xcconfig */; buildSettings = { + GCC_PREFIX_HEADER = ""; PRODUCT_NAME = finish_installation; }; name = "Release (GC dual-mode; 10.5-only)"; @@ -1235,6 +1252,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = FA1941D30D94A70100DD942E /* ConfigRelaunchDebug.xcconfig */; buildSettings = { + GCC_PREFIX_HEADER = ""; PRODUCT_NAME = finish_installation; }; name = Debug; @@ -1243,6 +1261,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = FA1941D40D94A70100DD942E /* ConfigRelaunchRelease.xcconfig */; buildSettings = { + GCC_PREFIX_HEADER = ""; PRODUCT_NAME = finish_installation; }; name = Release; diff --git a/Test Application/English.lproj/MainMenu.nib/classes.nib b/Test Application/English.lproj/MainMenu.nib/classes.nib new file mode 100644 index 00000000..14196291 --- /dev/null +++ b/Test Application/English.lproj/MainMenu.nib/classes.nib @@ -0,0 +1,43 @@ + + + + + IBClasses + + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + CLASS + NSObject + LANGUAGE + ObjC + + + ACTIONS + + checkForUpdates + id + + CLASS + SUUpdater + LANGUAGE + ObjC + OUTLETS + + delegate + id + + SUPERCLASS + NSObject + + + IBVersion + 1 + + diff --git a/Test Application/English.lproj/MainMenu.nib/info.nib b/Test Application/English.lproj/MainMenu.nib/info.nib new file mode 100644 index 00000000..09d03620 --- /dev/null +++ b/Test Application/English.lproj/MainMenu.nib/info.nib @@ -0,0 +1,21 @@ + + + + + IBFramework Version + 667 + IBLastKnownRelativeProjectPath + ../../Sparkle.xcodeproj + IBOldestOS + 5 + IBOpenObjects + + 2 + 57 + + IBSystem Version + 9D34 + targetFramework + IBCocoaFramework + + diff --git a/da.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/da.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 00000000..09004544 --- /dev/null +++ b/da.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,29 @@ +{ + IBClasses = ( + { + CLASS = FirstResponder; + LANGUAGE = ObjC; + SUPERCLASS = NSObject; + }, + { + CLASS = NSObject; + LANGUAGE = ObjC; + }, + { + ACTIONS = { + doNotInstall = id; + installLater = id; + installNow = id; + }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = SUWindowController; + }, + { + CLASS = SUWindowController; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/da.lproj/SUAutomaticUpdateAlert.nib/info.nib b/da.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 00000000..da986de6 --- /dev/null +++ b/da.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,18 @@ + + + + + IBDocumentLocation + 69 10 356 240 0 0 1680 1028 + IBFramework Version + 489.0 + IBLastKnownRelativeProjectPath + ../Sparkle.xcodeproj + IBOldestOS + 5 + IBSystem Version + 9E17 + targetFramework + IBCocoaFramework + + diff --git a/da.lproj/SUAutomaticUpdateAlert.strings b/da.lproj/SUAutomaticUpdateAlert.strings old mode 100755 new mode 100644 diff --git a/da.lproj/SUUpdateAlert.nib/classes.nib b/da.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 00000000..2a8a8572 --- /dev/null +++ b/da.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,40 @@ +{ + IBClasses = ( + { + CLASS = FirstResponder; + LANGUAGE = ObjC; + SUPERCLASS = NSObject; + }, + { + CLASS = NSApplication; + LANGUAGE = ObjC; + SUPERCLASS = NSResponder; + }, + { + CLASS = NSObject; + LANGUAGE = ObjC; + }, + { + ACTIONS = { + installUpdate = id; + remindMeLater = id; + skipThisVersion = id; + }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = { + delegate = id; + description = NSTextField; + installButton = NSButton; + releaseNotesView = WebView; + }; + SUPERCLASS = SUWindowController; + }, + { + CLASS = SUWindowController; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/da.lproj/SUUpdateAlert.nib/info.nib b/da.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 00000000..b1ef94ed --- /dev/null +++ b/da.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,22 @@ + + + + + IBDocumentLocation + 69 129 356 240 0 0 1920 1178 + IBFramework Version + 489.0 + IBLastKnownRelativeProjectPath + ../Sparkle.xcodeproj + IBOldestOS + 5 + IBOpenObjects + + 5 + + IBSystem Version + 9G55 + targetFramework + IBCocoaFramework + + diff --git a/da.lproj/SUUpdateAlert.nib/keyedobjects.nib b/da.lproj/SUUpdateAlert.nib/keyedobjects.nib index 75b515a5..1819d7a8 100644 Binary files a/da.lproj/SUUpdateAlert.nib/keyedobjects.nib and b/da.lproj/SUUpdateAlert.nib/keyedobjects.nib differ diff --git a/da.lproj/SUUpdateAlert.strings b/da.lproj/SUUpdateAlert.strings old mode 100755 new mode 100644 diff --git a/da.lproj/SUUpdatePermissionPrompt.nib/classes.nib b/da.lproj/SUUpdatePermissionPrompt.nib/classes.nib new file mode 100644 index 00000000..480bb357 --- /dev/null +++ b/da.lproj/SUUpdatePermissionPrompt.nib/classes.nib @@ -0,0 +1,34 @@ +{ + IBClasses = ( + { + CLASS = FirstResponder; + LANGUAGE = ObjC; + SUPERCLASS = NSObject; + }, + { + CLASS = NSObject; + LANGUAGE = ObjC; + }, + { + ACTIONS = { + finishPrompt = id; + toggleMoreInfo = id; + }; + CLASS = SUUpdatePermissionPrompt; + LANGUAGE = ObjC; + OUTLETS = { + delegate = id; + descriptionTextField = NSTextField; + moreInfoButton = NSButton; + moreInfoView = NSView; + }; + SUPERCLASS = SUWindowController; + }, + { + CLASS = SUWindowController; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/da.lproj/SUUpdatePermissionPrompt.nib/data.dependency b/da.lproj/SUUpdatePermissionPrompt.nib/data.dependency new file mode 100644 index 00000000..b7381f72 --- /dev/null +++ b/da.lproj/SUUpdatePermissionPrompt.nib/data.dependency @@ -0,0 +1,10 @@ + + + + + IBPaletteDependency + + Controllers + + + diff --git a/da.lproj/SUUpdatePermissionPrompt.nib/info.nib b/da.lproj/SUUpdatePermissionPrompt.nib/info.nib new file mode 100644 index 00000000..7b026327 --- /dev/null +++ b/da.lproj/SUUpdatePermissionPrompt.nib/info.nib @@ -0,0 +1,16 @@ + + + + + IBFramework Version + 489.0 + IBLastKnownRelativeProjectPath + ../Sparkle.xcodeproj + IBOldestOS + 5 + IBSystem Version + 9F33 + targetFramework + IBCocoaFramework + + diff --git a/da.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib b/da.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib index 608faf4b..4ef0a8b9 100644 Binary files a/da.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib and b/da.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib differ diff --git a/da.lproj/Sparkle.strings b/da.lproj/Sparkle.strings old mode 100755 new mode 100644 diff --git a/de.lproj/SUAutomaticUpdateAlert.strings b/de.lproj/SUAutomaticUpdateAlert.strings index 94183db3..276eac86 100644 Binary files a/de.lproj/SUAutomaticUpdateAlert.strings and b/de.lproj/SUAutomaticUpdateAlert.strings differ diff --git a/de.lproj/SUUpdateAlert.strings b/de.lproj/SUUpdateAlert.strings index 0ef30484..b9989994 100644 Binary files a/de.lproj/SUUpdateAlert.strings and b/de.lproj/SUUpdateAlert.strings differ diff --git a/de.lproj/SUUpdatePermissionPrompt.nib/classes.nib b/de.lproj/SUUpdatePermissionPrompt.nib/classes.nib new file mode 100644 index 00000000..0f776c89 --- /dev/null +++ b/de.lproj/SUUpdatePermissionPrompt.nib/classes.nib @@ -0,0 +1,59 @@ + + + + + IBClasses + + + CLASS + NSObject + LANGUAGE + ObjC + + + CLASS + SUWindowController + LANGUAGE + ObjC + SUPERCLASS + NSWindowController + + + ACTIONS + + finishPrompt + id + toggleMoreInfo + id + + CLASS + SUUpdatePermissionPrompt + LANGUAGE + ObjC + OUTLETS + + delegate + id + descriptionTextField + NSTextField + moreInfoButton + NSButton + moreInfoView + NSView + + SUPERCLASS + SUWindowController + + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + IBVersion + 1 + + diff --git a/de.lproj/SUUpdatePermissionPrompt.nib/info.nib b/de.lproj/SUUpdatePermissionPrompt.nib/info.nib new file mode 100644 index 00000000..6da5b470 --- /dev/null +++ b/de.lproj/SUUpdatePermissionPrompt.nib/info.nib @@ -0,0 +1,18 @@ + + + + + IBFramework Version + 677 + IBLastKnownRelativeProjectPath + ../Sparkle.xcodeproj + IBOldestOS + 5 + IBOpenObjects + + IBSystem Version + 9G55 + targetFramework + IBCocoaFramework + + diff --git a/de.lproj/SUUpdatePermissionPrompt.strings b/de.lproj/SUUpdatePermissionPrompt.strings new file mode 100644 index 00000000..d3fca25b Binary files /dev/null and b/de.lproj/SUUpdatePermissionPrompt.strings differ diff --git a/de.lproj/Sparkle.strings b/de.lproj/Sparkle.strings index 7233e484..8d9b29d8 100644 Binary files a/de.lproj/Sparkle.strings and b/de.lproj/Sparkle.strings differ diff --git a/en.lproj/SUUpdatePermissionPrompt.strings b/en.lproj/SUUpdatePermissionPrompt.strings new file mode 100644 index 00000000..75cd357e Binary files /dev/null and b/en.lproj/SUUpdatePermissionPrompt.strings differ diff --git a/es.lproj/SUAutomaticUpdateAlert.strings b/es.lproj/SUAutomaticUpdateAlert.strings new file mode 100644 index 00000000..e1615a2f Binary files /dev/null and b/es.lproj/SUAutomaticUpdateAlert.strings differ diff --git a/es.lproj/SUUpdateAlert.strings b/es.lproj/SUUpdateAlert.strings new file mode 100644 index 00000000..7d1f2ccf Binary files /dev/null and b/es.lproj/SUUpdateAlert.strings differ diff --git a/es.lproj/SUUpdatePermissionPrompt.nib/classes.nib b/es.lproj/SUUpdatePermissionPrompt.nib/classes.nib new file mode 100644 index 00000000..0f776c89 --- /dev/null +++ b/es.lproj/SUUpdatePermissionPrompt.nib/classes.nib @@ -0,0 +1,59 @@ + + + + + IBClasses + + + CLASS + NSObject + LANGUAGE + ObjC + + + CLASS + SUWindowController + LANGUAGE + ObjC + SUPERCLASS + NSWindowController + + + ACTIONS + + finishPrompt + id + toggleMoreInfo + id + + CLASS + SUUpdatePermissionPrompt + LANGUAGE + ObjC + OUTLETS + + delegate + id + descriptionTextField + NSTextField + moreInfoButton + NSButton + moreInfoView + NSView + + SUPERCLASS + SUWindowController + + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + IBVersion + 1 + + diff --git a/es.lproj/SUUpdatePermissionPrompt.nib/info.nib b/es.lproj/SUUpdatePermissionPrompt.nib/info.nib new file mode 100644 index 00000000..6da5b470 --- /dev/null +++ b/es.lproj/SUUpdatePermissionPrompt.nib/info.nib @@ -0,0 +1,18 @@ + + + + + IBFramework Version + 677 + IBLastKnownRelativeProjectPath + ../Sparkle.xcodeproj + IBOldestOS + 5 + IBOpenObjects + + IBSystem Version + 9G55 + targetFramework + IBCocoaFramework + + diff --git a/es.lproj/SUUpdatePermissionPrompt.strings b/es.lproj/SUUpdatePermissionPrompt.strings new file mode 100644 index 00000000..60c1329a Binary files /dev/null and b/es.lproj/SUUpdatePermissionPrompt.strings differ diff --git a/finish_installation.m b/finish_installation.m index 1db824bc..263127b2 100644 --- a/finish_installation.m +++ b/finish_installation.m @@ -63,8 +63,10 @@ { [[NSWorkspace sharedWorkspace] openFile:[[NSFileManager defaultManager] stringWithFileSystemRepresentation:executablePath length:strlen(executablePath)]]; #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 + [[NSFileManager defaultManager] removeFileAtPath: [SUInstaller updateFolder] handler: nil]; [[NSFileManager defaultManager] removeFileAtPath: selfPath handler: nil]; #else + [[NSFileManager defaultManager] removeItemAtPath: [SUInstaller updateFolder] error: NULL]; [[NSFileManager defaultManager] removeItemAtPath: selfPath error: NULL]; #endif exit(EXIT_SUCCESS); @@ -73,8 +75,28 @@ -(void) install { - NSBundle *theBundle = [NSBundle bundleWithPath: [NSString stringWithUTF8String: executablePath]]; - SUHost *theHost = [[[SUHost alloc] initWithBundle: theBundle] autorelease]; + NSBundle *theBundle = [NSBundle bundleWithPath: [NSString stringWithUTF8String: executablePath]]; + SUHost *theHost = [[[SUHost alloc] initWithBundle: theBundle] autorelease]; + + NSRect wdBox = NSMakeRect( 100, 100, 300, 70 ); + NSWindow *statusWindowHack = [[NSWindow alloc] initWithContentRect: wdBox + styleMask: NSTitledWindowMask backing: NSBackingStoreBuffered defer: NO]; // +++ LEAK, but app closes when this finishes anyway. + NSTextField *progressMessageField = [[[NSTextField alloc] initWithFrame: NSMakeRect( 12, 40, wdBox.size.width -24, 18 )] autorelease]; + [progressMessageField setStringValue: [[NSFileManager defaultManager] displayNameAtPath: [theHost bundlePath]]]; + [progressMessageField setDrawsBackground: NO]; + [progressMessageField setBordered: NO]; + [progressMessageField setBezeled: NO]; + [progressMessageField setEditable: NO]; + [[statusWindowHack contentView] addSubview: progressMessageField]; + + NSProgressIndicator *progressView = [[[NSProgressIndicator alloc] initWithFrame: NSMakeRect( 12, 16, wdBox.size.width -24, 16 )] autorelease]; + [progressView setStyle: NSProgressIndicatorBarStyle]; + [progressView setIndeterminate: YES]; + [[statusWindowHack contentView] addSubview: progressView]; + [statusWindowHack center]; + [[NSApplication sharedApplication] activateIgnoringOtherApps: YES]; + [statusWindowHack makeKeyAndOrderFront: nil]; + [progressView startAnimation: self]; [SUInstaller installFromUpdateFolder: [NSString stringWithUTF8String: folderPath] overHost: theHost diff --git a/fr.lproj/SUUpdatePermissionPrompt.nib/classes.nib b/fr.lproj/SUUpdatePermissionPrompt.nib/classes.nib new file mode 100644 index 00000000..0f776c89 --- /dev/null +++ b/fr.lproj/SUUpdatePermissionPrompt.nib/classes.nib @@ -0,0 +1,59 @@ + + + + + IBClasses + + + CLASS + NSObject + LANGUAGE + ObjC + + + CLASS + SUWindowController + LANGUAGE + ObjC + SUPERCLASS + NSWindowController + + + ACTIONS + + finishPrompt + id + toggleMoreInfo + id + + CLASS + SUUpdatePermissionPrompt + LANGUAGE + ObjC + OUTLETS + + delegate + id + descriptionTextField + NSTextField + moreInfoButton + NSButton + moreInfoView + NSView + + SUPERCLASS + SUWindowController + + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + IBVersion + 1 + + diff --git a/fr.lproj/SUUpdatePermissionPrompt.nib/info.nib b/fr.lproj/SUUpdatePermissionPrompt.nib/info.nib new file mode 100644 index 00000000..6da5b470 --- /dev/null +++ b/fr.lproj/SUUpdatePermissionPrompt.nib/info.nib @@ -0,0 +1,18 @@ + + + + + IBFramework Version + 677 + IBLastKnownRelativeProjectPath + ../Sparkle.xcodeproj + IBOldestOS + 5 + IBOpenObjects + + IBSystem Version + 9G55 + targetFramework + IBCocoaFramework + + diff --git a/fr.lproj/SUUpdatePermissionPrompt.strings b/fr.lproj/SUUpdatePermissionPrompt.strings new file mode 100644 index 00000000..0679dba4 Binary files /dev/null and b/fr.lproj/SUUpdatePermissionPrompt.strings differ diff --git a/it.lproj/SUAutomaticUpdateAlert.strings b/it.lproj/SUAutomaticUpdateAlert.strings new file mode 100644 index 00000000..8a28f34e Binary files /dev/null and b/it.lproj/SUAutomaticUpdateAlert.strings differ diff --git a/it.lproj/SUUpdateAlert.strings b/it.lproj/SUUpdateAlert.strings new file mode 100644 index 00000000..07e4c36c Binary files /dev/null and b/it.lproj/SUUpdateAlert.strings differ diff --git a/it.lproj/SUUpdatePermissionPrompt.nib/classes.nib b/it.lproj/SUUpdatePermissionPrompt.nib/classes.nib new file mode 100644 index 00000000..0f776c89 --- /dev/null +++ b/it.lproj/SUUpdatePermissionPrompt.nib/classes.nib @@ -0,0 +1,59 @@ + + + + + IBClasses + + + CLASS + NSObject + LANGUAGE + ObjC + + + CLASS + SUWindowController + LANGUAGE + ObjC + SUPERCLASS + NSWindowController + + + ACTIONS + + finishPrompt + id + toggleMoreInfo + id + + CLASS + SUUpdatePermissionPrompt + LANGUAGE + ObjC + OUTLETS + + delegate + id + descriptionTextField + NSTextField + moreInfoButton + NSButton + moreInfoView + NSView + + SUPERCLASS + SUWindowController + + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + IBVersion + 1 + + diff --git a/it.lproj/SUUpdatePermissionPrompt.nib/info.nib b/it.lproj/SUUpdatePermissionPrompt.nib/info.nib new file mode 100644 index 00000000..6da5b470 --- /dev/null +++ b/it.lproj/SUUpdatePermissionPrompt.nib/info.nib @@ -0,0 +1,18 @@ + + + + + IBFramework Version + 677 + IBLastKnownRelativeProjectPath + ../Sparkle.xcodeproj + IBOldestOS + 5 + IBOpenObjects + + IBSystem Version + 9G55 + targetFramework + IBCocoaFramework + + diff --git a/it.lproj/SUUpdatePermissionPrompt.strings b/it.lproj/SUUpdatePermissionPrompt.strings new file mode 100644 index 00000000..321d07ad Binary files /dev/null and b/it.lproj/SUUpdatePermissionPrompt.strings differ diff --git a/ja.lproj/SUUpdatePermissionPrompt.strings b/ja.lproj/SUUpdatePermissionPrompt.strings new file mode 100644 index 00000000..c6d2a341 Binary files /dev/null and b/ja.lproj/SUUpdatePermissionPrompt.strings differ diff --git a/nl.lproj/SUUpdatePermissionPrompt.nib/classes.nib b/nl.lproj/SUUpdatePermissionPrompt.nib/classes.nib new file mode 100644 index 00000000..5220a221 --- /dev/null +++ b/nl.lproj/SUUpdatePermissionPrompt.nib/classes.nib @@ -0,0 +1,59 @@ + + + + + IBClasses + + + CLASS + SUWindowController + LANGUAGE + ObjC + SUPERCLASS + NSWindowController + + + ACTIONS + + finishPrompt + id + toggleMoreInfo + id + + CLASS + SUUpdatePermissionPrompt + LANGUAGE + ObjC + OUTLETS + + delegate + id + descriptionTextField + NSTextField + moreInfoButton + NSButton + moreInfoView + NSView + + SUPERCLASS + SUWindowController + + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + CLASS + NSObject + LANGUAGE + ObjC + + + IBVersion + 1 + + diff --git a/nl.lproj/SUUpdatePermissionPrompt.nib/info.nib b/nl.lproj/SUUpdatePermissionPrompt.nib/info.nib new file mode 100644 index 00000000..d2586ea2 --- /dev/null +++ b/nl.lproj/SUUpdatePermissionPrompt.nib/info.nib @@ -0,0 +1,16 @@ + + + + + IBFramework Version + 629 + IBOldestOS + 5 + IBOpenObjects + + IBSystem Version + 9E17 + targetFramework + IBCocoaFramework + + diff --git a/pt.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/pt.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 00000000..46e6ac4c --- /dev/null +++ b/pt.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,50 @@ + + + + + IBClasses + + + CLASS + NSObject + LANGUAGE + ObjC + + + CLASS + SUWindowController + LANGUAGE + ObjC + SUPERCLASS + NSWindowController + + + ACTIONS + + doNotInstall + id + installLater + id + installNow + id + + CLASS + SUAutomaticUpdateAlert + LANGUAGE + ObjC + SUPERCLASS + SUWindowController + + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + IBVersion + 1 + + diff --git a/pt.lproj/SUAutomaticUpdateAlert.nib/info.nib b/pt.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 00000000..6da5b470 --- /dev/null +++ b/pt.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,18 @@ + + + + + IBFramework Version + 677 + IBLastKnownRelativeProjectPath + ../Sparkle.xcodeproj + IBOldestOS + 5 + IBOpenObjects + + IBSystem Version + 9G55 + targetFramework + IBCocoaFramework + + diff --git a/pt.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/pt.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib new file mode 100644 index 00000000..2fb25911 Binary files /dev/null and b/pt.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib differ diff --git a/pt.lproj/SUAutomaticUpdateAlert.strings b/pt.lproj/SUAutomaticUpdateAlert.strings new file mode 100644 index 00000000..959e2811 --- /dev/null +++ b/pt.lproj/SUAutomaticUpdateAlert.strings @@ -0,0 +1,12 @@ + +/* Class = "NSButtonCell"; title = "Install and Relaunch"; ObjectID = "41"; */ +"Install and Relaunch" = "Instalar e reiniciar"; + +/* Class = "NSButtonCell"; title = "Install on Quit"; ObjectID = "42"; */ +"Install on Quit" = "Install on Quit"; + +/* NSButton (Automatically download and install updates in the future) : (oid:17) */ +"Automatically download and install updates in the future" = "Descarregar e instalar atualizações automaticamente no futuro"; + +/* Class = "NSButtonCell"; title = "Don't Install"; ObjectID = "44"; */ +"Don't Install" = "Don't Install"; \ No newline at end of file diff --git a/pt.lproj/SUUpdateAlert.nib/classes.nib b/pt.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 00000000..753be8d3 --- /dev/null +++ b/pt.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,69 @@ + + + + + IBClasses + + + CLASS + NSObject + LANGUAGE + ObjC + + + CLASS + SUWindowController + LANGUAGE + ObjC + SUPERCLASS + NSWindowController + + + CLASS + NSApplication + LANGUAGE + ObjC + SUPERCLASS + NSResponder + + + ACTIONS + + installUpdate + id + remindMeLater + id + skipThisVersion + id + + CLASS + SUUpdateAlert + LANGUAGE + ObjC + OUTLETS + + delegate + id + description + NSTextField + installButton + NSButton + releaseNotesView + WebView + + SUPERCLASS + SUWindowController + + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + IBVersion + 1 + + diff --git a/pt.lproj/SUUpdateAlert.nib/info.nib b/pt.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 00000000..6da5b470 --- /dev/null +++ b/pt.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,18 @@ + + + + + IBFramework Version + 677 + IBLastKnownRelativeProjectPath + ../Sparkle.xcodeproj + IBOldestOS + 5 + IBOpenObjects + + IBSystem Version + 9G55 + targetFramework + IBCocoaFramework + + diff --git a/pt.lproj/SUUpdateAlert.nib/keyedobjects.nib b/pt.lproj/SUUpdateAlert.nib/keyedobjects.nib new file mode 100644 index 00000000..7813b4be Binary files /dev/null and b/pt.lproj/SUUpdateAlert.nib/keyedobjects.nib differ diff --git a/pt.lproj/SUUpdateAlert.strings b/pt.lproj/SUUpdateAlert.strings new file mode 100644 index 00000000..90520864 Binary files /dev/null and b/pt.lproj/SUUpdateAlert.strings differ diff --git a/pt.lproj/SUUpdatePermissionPrompt.nib/classes.nib b/pt.lproj/SUUpdatePermissionPrompt.nib/classes.nib new file mode 100644 index 00000000..0f776c89 --- /dev/null +++ b/pt.lproj/SUUpdatePermissionPrompt.nib/classes.nib @@ -0,0 +1,59 @@ + + + + + IBClasses + + + CLASS + NSObject + LANGUAGE + ObjC + + + CLASS + SUWindowController + LANGUAGE + ObjC + SUPERCLASS + NSWindowController + + + ACTIONS + + finishPrompt + id + toggleMoreInfo + id + + CLASS + SUUpdatePermissionPrompt + LANGUAGE + ObjC + OUTLETS + + delegate + id + descriptionTextField + NSTextField + moreInfoButton + NSButton + moreInfoView + NSView + + SUPERCLASS + SUWindowController + + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + IBVersion + 1 + + diff --git a/pt.lproj/SUUpdatePermissionPrompt.nib/info.nib b/pt.lproj/SUUpdatePermissionPrompt.nib/info.nib new file mode 100644 index 00000000..6da5b470 --- /dev/null +++ b/pt.lproj/SUUpdatePermissionPrompt.nib/info.nib @@ -0,0 +1,18 @@ + + + + + IBFramework Version + 677 + IBLastKnownRelativeProjectPath + ../Sparkle.xcodeproj + IBOldestOS + 5 + IBOpenObjects + + IBSystem Version + 9G55 + targetFramework + IBCocoaFramework + + diff --git a/pt.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib b/pt.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib new file mode 100644 index 00000000..a5896082 Binary files /dev/null and b/pt.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib differ diff --git a/pt.lproj/SUUpdatePermissionPrompt.strings b/pt.lproj/SUUpdatePermissionPrompt.strings new file mode 100644 index 00000000..82477d56 Binary files /dev/null and b/pt.lproj/SUUpdatePermissionPrompt.strings differ diff --git a/pt.lproj/Sparkle.strings b/pt.lproj/Sparkle.strings new file mode 100644 index 00000000..8d8b324b --- /dev/null +++ b/pt.lproj/Sparkle.strings @@ -0,0 +1,95 @@ +/* No comment provided by engineer. */ +"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?"; + +/* No comment provided by engineer. */ +"%1$@ can't be updated when it's running from a read-only volume like a disk image or an optical drive. Move %1$@ to your Applications folder, relaunch it from there, and try again." = "%1$@ can't be updated when it's running from a read-only volume like a disk image or an optical drive. Move %1$@ to your Applications folder, relaunch it from there, and try again."; + +/* No comment provided by engineer. */ +"%@ %@ is currently the newest version available." = "%1$@ %2$@ é atualmente a versão mais nova disponível."; + +/* No comment provided by engineer. */ +"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ está disponível—você possui a %3$@. Gostaria de obtê-la agora?"; + +/* No comment provided by engineer. */ +"%@ downloaded" = "%@ downloaded"; + +/* No comment provided by engineer. */ +"%@ of %@" = "%1$@ de %2$@"; + +/* No comment provided by engineer. */ +"A new version of %@ is available!" = "Uma nova versão do %@ está disponível!"; + +/* No comment provided by engineer. */ +"A new version of %@ is ready to install!" = "A new version of %@ is ready to install!"; + +/* No comment provided by engineer. */ +"An error occurred in retrieving update information. Please try again later." = "Um erro ocorreu durante a obtenção dos dados de atualização. Por favor tente novamente mais tarde."; + +/* No comment provided by engineer. */ +"An error occurred while downloading the update. Please try again later." = "An error occurred while downloading the update. Please try again later."; + +/* No comment provided by engineer. */ +"An error occurred while extracting the archive. Please try again later." = "Um erro ocorreu durante a extração dos arquivos. Por favor tente novamente mais tarde."; + +/* No comment provided by engineer. */ +"An error occurred while installing the update. Please try again later." = "An error occurred while installing the update. Please try again later."; + +/* No comment provided by engineer. */ +"An error occurred while parsing the update feed." = "An error occurred while parsing the update feed."; + +/* No comment provided by engineer. */ +"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@."; + +/* the unit for bytes */ +"B" = "B"; + +/* No comment provided by engineer. */ +"Cancel" = "Cancelar"; + +/* No comment provided by engineer. */ +"Cancel Update" = "Cancel Update"; + +/* No comment provided by engineer. */ +"Checking for updates..." = "Checking for updates…"; + +/* No comment provided by engineer. */ +"Downloading update..." = "Obtendo atualizações..."; + +/* No comment provided by engineer. */ +"Extracting update..." = "Extraindo atualizações..."; + +/* the unit for gigabytes */ +"GB" = "GB"; + +/* No comment provided by engineer. */ +"Install and Relaunch" = "Instalar e reiniciar"; + +/* No comment provided by engineer. */ +"Installing update..." = "Instalando atualizações..."; + +/* the unit for kilobytes */ +"KB" = "KB"; + +/* the unit for megabytes */ +"MB" = "MB"; + +/* No comment provided by engineer. */ +"OK" = "OK"; + +/* No comment provided by engineer. */ +"Ready to Install" = "Pronto para instalar"; + +/* No comment provided by engineer. */ +"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu."; + +/* No comment provided by engineer. */ +"Update Error!" = "Erro de atualização!"; + +/* No comment provided by engineer. */ +"Updating %@" = "Atualizando %@"; + +/* No comment provided by engineer. */ +"You already have the newest version of %@." = "You already have the newest version of %@."; + +/* No comment provided by engineer. */ +"You're up-to-date!" = "Aplicativo está atualizado!"; \ No newline at end of file diff --git a/ru.lproj/SUUpdatePermissionPrompt.nib/classes.nib b/ru.lproj/SUUpdatePermissionPrompt.nib/classes.nib new file mode 100644 index 00000000..0f776c89 --- /dev/null +++ b/ru.lproj/SUUpdatePermissionPrompt.nib/classes.nib @@ -0,0 +1,59 @@ + + + + + IBClasses + + + CLASS + NSObject + LANGUAGE + ObjC + + + CLASS + SUWindowController + LANGUAGE + ObjC + SUPERCLASS + NSWindowController + + + ACTIONS + + finishPrompt + id + toggleMoreInfo + id + + CLASS + SUUpdatePermissionPrompt + LANGUAGE + ObjC + OUTLETS + + delegate + id + descriptionTextField + NSTextField + moreInfoButton + NSButton + moreInfoView + NSView + + SUPERCLASS + SUWindowController + + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + IBVersion + 1 + + diff --git a/ru.lproj/SUUpdatePermissionPrompt.nib/info.nib b/ru.lproj/SUUpdatePermissionPrompt.nib/info.nib new file mode 100644 index 00000000..5132e29f --- /dev/null +++ b/ru.lproj/SUUpdatePermissionPrompt.nib/info.nib @@ -0,0 +1,18 @@ + + + + + IBFramework Version + 670 + IBLastKnownRelativeProjectPath + ../Sparkle.xcodeproj + IBOldestOS + 5 + IBOpenObjects + + IBSystem Version + 9E17 + targetFramework + IBCocoaFramework + + diff --git a/sv.lproj/SUUpdatePermissionPrompt.nib/classes.nib b/sv.lproj/SUUpdatePermissionPrompt.nib/classes.nib new file mode 100644 index 00000000..5220a221 --- /dev/null +++ b/sv.lproj/SUUpdatePermissionPrompt.nib/classes.nib @@ -0,0 +1,59 @@ + + + + + IBClasses + + + CLASS + SUWindowController + LANGUAGE + ObjC + SUPERCLASS + NSWindowController + + + ACTIONS + + finishPrompt + id + toggleMoreInfo + id + + CLASS + SUUpdatePermissionPrompt + LANGUAGE + ObjC + OUTLETS + + delegate + id + descriptionTextField + NSTextField + moreInfoButton + NSButton + moreInfoView + NSView + + SUPERCLASS + SUWindowController + + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + CLASS + NSObject + LANGUAGE + ObjC + + + IBVersion + 1 + + diff --git a/sv.lproj/SUUpdatePermissionPrompt.nib/info.nib b/sv.lproj/SUUpdatePermissionPrompt.nib/info.nib new file mode 100644 index 00000000..c5a067e8 --- /dev/null +++ b/sv.lproj/SUUpdatePermissionPrompt.nib/info.nib @@ -0,0 +1,20 @@ + + + + + IBFramework Version + 670 + IBLastKnownRelativeProjectPath + ../Sparkle.xcodeproj + IBOldestOS + 5 + IBOpenObjects + + 6 + + IBSystem Version + 10A96 + targetFramework + IBCocoaFramework + + diff --git a/zh_CN.lproj/SUUpdatePermissionPrompt.strings b/zh_CN.lproj/SUUpdatePermissionPrompt.strings new file mode 100644 index 00000000..88b715f9 Binary files /dev/null and b/zh_CN.lproj/SUUpdatePermissionPrompt.strings differ