mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-27 05:04:27 +00:00
Removed unused synchronous installation
This commit is contained in:
1 parent
bf9ba560f0
commit
55a7ca5b9c
6 files changed
+32
-40
No files matched your search
Vendored
+5
-5
@@ -157,11 +157,11 @@ static const NSTimeInterval SUParentQuitCheckInterval = .5;
|
||||
[statusCtl release];
|
||||
}
|
||||
|
||||
[SUInstaller installFromUpdateFolder: [[NSFileManager defaultManager] stringWithFileSystemRepresentation: folderpath length: strlen(folderpath)]
|
||||
overHost: host
|
||||
installationPath: installationPath
|
||||
delegate: self synchronously: NO
|
||||
versionComparator: [SUStandardVersionComparator defaultComparator]];
|
||||
[SUInstaller installFromUpdateFolder:[[NSFileManager defaultManager] stringWithFileSystemRepresentation:folderpath length:strlen(folderpath)]
|
||||
overHost:host
|
||||
installationPath:installationPath
|
||||
delegate:self
|
||||
versionComparator:[SUStandardVersionComparator defaultComparator]];
|
||||
}
|
||||
|
||||
- (void)installerFinishedForHost:(SUHost *) __unused aHost
|
||||
|
||||
Vendored
+6
-4
@@ -16,10 +16,12 @@
|
||||
|
||||
@class SUHost;
|
||||
@interface SUInstaller : NSObject
|
||||
+ (NSString *) appPathInUpdateFolder:(NSString *)updateFolder forHost:(SUHost *)host;
|
||||
+ (void) installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath delegate:(id<SUInstallerDelegate>)delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator;
|
||||
+ (void) finishInstallationToPath:(NSString *)installationPath withResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:(id<SUInstallerDelegate>)delegate;
|
||||
+ (NSString*) updateFolder;
|
||||
|
||||
+ (NSString *)appPathInUpdateFolder:(NSString *)updateFolder forHost:(SUHost *)host;
|
||||
+ (void)installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath delegate:(id<SUInstallerDelegate>)delegate versionComparator:(id<SUVersionComparison>)comparator;
|
||||
+ (void)finishInstallationToPath:(NSString *)installationPath withResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:(id<SUInstallerDelegate>)delegate;
|
||||
+ (NSString *)updateFolder;
|
||||
|
||||
@end
|
||||
|
||||
@protocol SUInstallerDelegate <NSObject>
|
||||
|
||||
Vendored
+10
-10
@@ -117,19 +117,19 @@ static NSString* sUpdateFolder = nil;
|
||||
return isPackage ? nil : path;
|
||||
}
|
||||
|
||||
+ (void)installFromUpdateFolder:(NSString *)inUpdateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath delegate:(id<SUInstallerDelegate>)delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator
|
||||
+ (void)installFromUpdateFolder:(NSString *)inUpdateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath delegate:(id<SUInstallerDelegate>)delegate versionComparator:(id<SUVersionComparison>)comparator
|
||||
{
|
||||
BOOL isPackage = NO;
|
||||
NSString *newAppDownloadPath = [self installSourcePathInUpdateFolder:inUpdateFolder forHost:host isPackage:&isPackage];
|
||||
NSString *newAppDownloadPath = [self installSourcePathInUpdateFolder:inUpdateFolder forHost:host isPackage:&isPackage];
|
||||
|
||||
if (newAppDownloadPath == nil)
|
||||
{
|
||||
[self finishInstallationToPath:installationPath withResult:NO host:host error:[NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:@{NSLocalizedDescriptionKey: @"Couldn't find an appropriate update in the downloaded package."}] delegate:delegate];
|
||||
}
|
||||
else
|
||||
{
|
||||
[(isPackage ? [SUPackageInstaller class] : [SUPlainInstaller class]) performInstallationToPath:installationPath fromPath:newAppDownloadPath host:host delegate:delegate synchronously:synchronously versionComparator:comparator];
|
||||
}
|
||||
if (newAppDownloadPath == nil)
|
||||
{
|
||||
[self finishInstallationToPath:installationPath withResult:NO host:host error:[NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:@{ NSLocalizedDescriptionKey: @"Couldn't find an appropriate update in the downloaded package." }] delegate:delegate];
|
||||
}
|
||||
else
|
||||
{
|
||||
[(isPackage ? [SUPackageInstaller class] : [SUPlainInstaller class])performInstallationToPath:installationPath fromPath:newAppDownloadPath host:host delegate:delegate versionComparator:comparator];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)mdimportInstallationPath:(NSString *)installationPath
|
||||
|
||||
Vendored
+4
-10
@@ -12,7 +12,7 @@
|
||||
|
||||
@implementation SUPackageInstaller
|
||||
|
||||
+ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:(id<SUInstallerDelegate>)delegate synchronously:(BOOL)synchronously versionComparator:(id<SUVersionComparison>)__unused comparator
|
||||
+ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:(id<SUInstallerDelegate>)delegate versionComparator:(id<SUVersionComparison>)__unused comparator
|
||||
{
|
||||
// Run installer using the "open" command to ensure it is launched in front of current application.
|
||||
// -W = wait until the app has quit.
|
||||
@@ -27,21 +27,15 @@
|
||||
return;
|
||||
}
|
||||
|
||||
void (^performInstallation)() = ^void() {
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||
NSTask *installer = [NSTask launchedTaskWithLaunchPath:command arguments:args];
|
||||
[installer waitUntilExit];
|
||||
|
||||
// Known bug: if the installation fails or is canceled, Sparkle goes ahead and restarts, thinking everything is fine.
|
||||
dispatch_async(dispatch_get_main_queue(), ^ {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self finishInstallationToPath:installationPath withResult:YES host:host error:nil delegate:delegate];
|
||||
});
|
||||
};
|
||||
|
||||
if (synchronously) {
|
||||
performInstallation();
|
||||
} else {
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), performInstallation);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@end
|
||||
Vendored
+3
-1
@@ -20,7 +20,9 @@
|
||||
@class SUHost;
|
||||
|
||||
@interface SUPlainInstaller : SUInstaller
|
||||
+ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:(id<SUInstallerDelegate>)delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator;
|
||||
|
||||
+ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:(id<SUInstallerDelegate>)delegate versionComparator:(id<SUVersionComparison>)comparator;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
Vendored
+4
-10
@@ -13,7 +13,7 @@
|
||||
|
||||
@implementation SUPlainInstaller
|
||||
|
||||
+ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:(id<SUInstallerDelegate>)delegate synchronously:(BOOL)synchronously versionComparator:(id<SUVersionComparison>)comparator
|
||||
+ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:(id<SUInstallerDelegate>)delegate versionComparator:(id<SUVersionComparison>)comparator
|
||||
{
|
||||
// Prevent malicious downgrades:
|
||||
#if !PERMIT_AUTOMATED_DOWNGRADES
|
||||
@@ -26,7 +26,7 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
void (^performInstallation)() = ^void() {
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||
NSError *error = nil;
|
||||
NSString *oldPath = [host bundlePath];
|
||||
NSString *tempName = [self temporaryNameForPath:[host installationPath]];
|
||||
@@ -41,16 +41,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^ {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self finishInstallationToPath:installationPath withResult:result host:host error:error delegate:delegate];
|
||||
});
|
||||
};
|
||||
|
||||
if (synchronously) {
|
||||
performInstallation();
|
||||
} else {
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), performInstallation);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user