diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index fa71e69b..9803ed18 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -281,6 +281,8 @@ 72AC6B2A1B9AAF3A00F62325 /* SparkleTestCodeSignApp.tar.bz2 in Resources */ = {isa = PBXBuildFile; fileRef = 72AC6B291B9AAF3A00F62325 /* SparkleTestCodeSignApp.tar.bz2 */; }; 72AC6B2C1B9AB0EE00F62325 /* SparkleTestCodeSignApp.tar.xz in Resources */ = {isa = PBXBuildFile; fileRef = 72AC6B2B1B9AB0EE00F62325 /* SparkleTestCodeSignApp.tar.xz */; }; 72AC6B2E1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg in Resources */ = {isa = PBXBuildFile; fileRef = 72AC6B2D1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg */; }; + 72C4AB7A25E0B4C500D14562 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; }; + 72C4ABAB25E0BF1900D14562 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; }; 72D4DAA11AD7632900B211E2 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7268AC621AD634C200C3E0C1 /* SUBinaryDeltaCreate.m */; }; 72E1D7DD25A3E3AD0001BA6D /* SUWebViewCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E1D7D625A3E3AC0001BA6D /* SUWebViewCommon.m */; }; 72E1D7DE25A3E3AD0001BA6D /* SUWebViewCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 72E1D7D725A3E3AC0001BA6D /* SUWebViewCommon.h */; }; @@ -2417,6 +2419,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 72C4ABAB25E0BF1900D14562 /* SULog.m in Sources */, 14652F7D19A9726700959E44 /* SUBinaryDeltaApply.m in Sources */, 14652F7C19A9725300959E44 /* SUBinaryDeltaCommon.m in Sources */, 7268AC631AD634C200C3E0C1 /* SUBinaryDeltaCreate.m in Sources */, @@ -2469,6 +2472,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 72C4AB7A25E0B4C500D14562 /* SULog.m in Sources */, 722954B71D04ADAF00ECF9CA /* fileop.m in Sources */, 722954BD1D04AE3800ECF9CA /* SUConstants.m in Sources */, 722954BC1D04AE1100ECF9CA /* SUFileManager.m in Sources */, diff --git a/Sparkle/Autoupdate/Autoupdate.m b/Sparkle/Autoupdate/Autoupdate.m index 92c38e6b..9d48b1d1 100644 --- a/Sparkle/Autoupdate/Autoupdate.m +++ b/Sparkle/Autoupdate/Autoupdate.m @@ -136,7 +136,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5; self.statusController = [[SUStatusController alloc] initWithHost:host]; [self.statusController setButtonTitle:SULocalizedString(@"Cancel Update", @"") target:nil action:Nil isDefault:NO]; [self.statusController beginActionWithTitle:SULocalizedString(@"Installing update...", @"") - maxProgressValue:100 statusText: @""]; + maxProgressValue:installer.supportsDeterminateProgress ? 100 : 0 statusText: @""]; [self.statusController showWindow:self]; } @@ -153,7 +153,9 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5; void(^progressBlock)(double) = ^(double progress){ dispatch_async(dispatch_get_main_queue(), ^(){ - self.statusController.progressValue = progress * 100.0; + if (installer.supportsDeterminateProgress) { + self.statusController.progressValue = progress * 100.0; + } }); }; diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index 8ede3a8d..be4a8f83 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -10,6 +10,7 @@ #import "SUOperatingSystem.h" #import "SUFileOperationConstants.h" +#import "SULog.h" #import "SUErrors.h" #include @@ -320,7 +321,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { return NO; } - NSLog(@"Sparkle: Authorization required to remove quarantine %@", rootURL); + SULog(SULogLevelDefault, @"Sparkle: Authorization required to remove quarantine: %@", rootURL); NSError *executeError = nil; BOOL success = [self _authorizeAndExecuteCommand:SUFileOpRemoveQuarantineCommand sourcePath:path destinationPath:NULL error:&executeError]; @@ -520,7 +521,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { return NO; } - NSLog(@"Sparkle: Authorization required to copy %@ to %@", sourceURL, destinationURL); + SULog(SULogLevelDefault, @"Sparkle: Authorization required to copy %@ to %@", sourceURL, destinationURL); NSError *executeError = nil; if (![self _authorizeAndExecuteCommand:SUFileOpCopyCommand sourcePath:sourcePath destinationPath:destinationPath error:&executeError]) { @@ -614,7 +615,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { return NO; } - NSLog(@"Sparkle: Authorization required to move %@ to %@", sourceURL, destinationURL); + SULog(SULogLevelDefault, @"Sparkle: Authorization required to move %@ to %@", sourceURL, destinationURL); char sourcePath[PATH_MAX] = {0}; if (![sourceURL.path getFileSystemRepresentation:sourcePath maxLength:sizeof(sourcePath)]) { @@ -785,7 +786,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { return NO; } - NSLog(@"Sparkle: Authorization required to change permissions of %@ to match %@", targetURL, matchURL); + SULog(SULogLevelDefault, @"Sparkle: Authorization required to change permissions of %@ to match %@", targetURL, matchURL); NSError *executeError = nil; BOOL success = [self _authorizeAndExecuteCommand:SUFileOpChangeOwnerAndGroupCommand sourcePath:targetPath destinationPath:matchPath error:&executeError]; @@ -844,7 +845,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { return NO; } - NSLog(@"Sparkle: Authorization required to update timestamp of %@", targetURL); + SULog(SULogLevelDefault, @"Sparkle: Authorization required to update timestamp of %@", targetURL); NSError *executeError = nil; BOOL success = [self _authorizeAndExecuteCommand:SUFileOpUpdateModificationAndAccessTimeCommand sourcePath:path destinationPath:NULL error:&executeError]; @@ -888,7 +889,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { return NO; } - NSLog(@"Sparkle: Authorization required to make directory %@", url); + SULog(SULogLevelDefault, @"Sparkle: Authorization required to make directory %@", url); char path[PATH_MAX] = {0}; if (![url.path getFileSystemRepresentation:path maxLength:sizeof(path)]) { @@ -952,7 +953,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { return NO; } - NSLog(@"Sparkle: Authorization required to delete %@", url); + SULog(SULogLevelDefault, @"Sparkle: Authorization required to delete %@", url); char path[PATH_MAX] = {0}; if (![url.path getFileSystemRepresentation:path maxLength:sizeof(path)]) { @@ -990,7 +991,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { return NO; } - NSLog(@"Sparkle: Authorization required to run pkg installer %@", packageURL); + SULog(SULogLevelDefault, @"Sparkle: Authorization required to run pkg installer %@", packageURL); NSError *executeError = nil; BOOL success = [self _authorizeAndExecuteCommand:SUFileOpInstallCommand sourcePath:path destinationPath:NULL lineCallback:^(NSString *line){ diff --git a/Sparkle/SUGuidedPackageInstaller.m b/Sparkle/SUGuidedPackageInstaller.m index 9c8e6e50..8eecd707 100644 --- a/Sparkle/SUGuidedPackageInstaller.m +++ b/Sparkle/SUGuidedPackageInstaller.m @@ -54,4 +54,11 @@ return YES; } +// We used to, but it broke due to fragile text processing +// Maybe one day someone will fix it, but until then. +- (BOOL)supportsDeterminateProgress +{ + return NO; +} + @end diff --git a/Sparkle/SUInstallerProtocol.h b/Sparkle/SUInstallerProtocol.h index 75312c47..599aa39f 100644 --- a/Sparkle/SUInstallerProtocol.h +++ b/Sparkle/SUInstallerProtocol.h @@ -31,6 +31,8 @@ NS_ASSUME_NONNULL_BEGIN // Should be thread safe - (NSString *)installationPath; +- (BOOL)supportsDeterminateProgress; + @end NS_ASSUME_NONNULL_END diff --git a/Sparkle/SUPackageInstaller.m b/Sparkle/SUPackageInstaller.m index ca2e4e7b..eba0d66e 100644 --- a/Sparkle/SUPackageInstaller.m +++ b/Sparkle/SUPackageInstaller.m @@ -78,4 +78,9 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open"; return NO; } +- (BOOL)supportsDeterminateProgress +{ + return NO; +} + @end diff --git a/Sparkle/SUPlainInstaller.m b/Sparkle/SUPlainInstaller.m index ec51b644..0cd5c041 100644 --- a/Sparkle/SUPlainInstaller.m +++ b/Sparkle/SUPlainInstaller.m @@ -265,4 +265,9 @@ return YES; } +- (BOOL)supportsDeterminateProgress +{ + return YES; +} + @end