diff --git a/Sparkle/SPUStandardUpdaterController.m b/Sparkle/SPUStandardUpdaterController.m index e9aa91dc..6167612d 100644 --- a/Sparkle/SPUStandardUpdaterController.m +++ b/Sparkle/SPUStandardUpdaterController.m @@ -40,7 +40,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults self.initializedUpdater = YES; NSBundle *hostBundle = [NSBundle mainBundle]; - id userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:hostBundle delegate:self.userDriverDelegate]; + id userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:hostBundle applicationBundle:hostBundle delegate:self.userDriverDelegate]; self.updater = [[SPUUpdater alloc] initWithHostBundle:hostBundle userDriver:userDriver delegate:self.updaterDelegate]; self.userDriver = userDriver; diff --git a/Sparkle/SPUStandardUserDriver.h b/Sparkle/SPUStandardUserDriver.h index c976015c..2642dcb9 100644 --- a/Sparkle/SPUStandardUserDriver.h +++ b/Sparkle/SPUStandardUserDriver.h @@ -24,9 +24,10 @@ SU_EXPORT @interface SPUStandardUserDriver : NSObject )delegate; +- (instancetype)initWithHostBundle:(NSBundle *)hostBundle applicationBundle:(NSBundle *)applicationBundle delegate:(nullable id)delegate; @end diff --git a/Sparkle/SPUStandardUserDriver.m b/Sparkle/SPUStandardUserDriver.m index 44c81b41..20ec9002 100644 --- a/Sparkle/SPUStandardUserDriver.m +++ b/Sparkle/SPUStandardUserDriver.m @@ -23,6 +23,7 @@ @interface SPUStandardUserDriver () @property (nonatomic, readonly) SUHost *host; +@property (nonatomic, readonly) NSBundle *applicationBundle; @property (nonatomic, readonly) SPUUserDriverCoreComponent *coreComponent; @property (nonatomic, readonly) SPUUserDriverUIComponent *uiComponent; @@ -37,6 +38,7 @@ @implementation SPUStandardUserDriver @synthesize host = _host; +@synthesize applicationBundle = _applicationBundle; @synthesize coreComponent = _coreComponent; @synthesize uiComponent = _uiComponent; @synthesize delegate = _delegate; @@ -46,11 +48,12 @@ #pragma mark Birth -- (instancetype)initWithHostBundle:(NSBundle *)hostBundle delegate:(id)delegate +- (instancetype)initWithHostBundle:(NSBundle *)hostBundle applicationBundle:(NSBundle *)applicationBundle delegate:(nullable id)delegate { self = [super init]; if (self != nil) { _host = [[SUHost alloc] initWithBundle:hostBundle]; + _applicationBundle = applicationBundle; _delegate = delegate; _coreComponent = [[SPUUserDriverCoreComponent alloc] init]; _uiComponent = [[SPUUserDriverUIComponent alloc] init]; @@ -397,7 +400,7 @@ [self.statusController close]; self.statusController = nil; - [self.uiComponent terminateApplicationForBundle:self.host.bundle]; + [self.uiComponent terminateApplicationForBundle:self.applicationBundle]; }); } diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index ca3df4b3..5a125915 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -74,7 +74,7 @@ static NSMutableDictionary *sharedUpdaters = nil; } [sharedUpdaters setObject:self forKey:[NSValue valueWithNonretainedObject:bundle]]; - _userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:bundle delegate:self]; + _userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:bundle applicationBundle:bundle delegate:self]; _updater = [[SPUUpdater alloc] initWithHostBundle:bundle userDriver:_userDriver delegate:self]; NSError *updaterError = nil; diff --git a/TestApplication/SUPopUpTitlebarUserDriver.h b/TestApplication/SUPopUpTitlebarUserDriver.h index 88728661..dbbdcb0f 100644 --- a/TestApplication/SUPopUpTitlebarUserDriver.h +++ b/TestApplication/SUPopUpTitlebarUserDriver.h @@ -13,6 +13,6 @@ @interface SUPopUpTitlebarUserDriver : NSObject -- (instancetype)initWithHostBundle:(NSBundle *)hostBundle window:(NSWindow *)window; +- (instancetype)initWithApplicationBundle:(NSBundle *)applicationBundle window:(NSWindow *)window; @end diff --git a/TestApplication/SUPopUpTitlebarUserDriver.m b/TestApplication/SUPopUpTitlebarUserDriver.m index 3d8a5ad9..050c3a0a 100644 --- a/TestApplication/SUPopUpTitlebarUserDriver.m +++ b/TestApplication/SUPopUpTitlebarUserDriver.m @@ -11,7 +11,7 @@ @interface SUPopUpTitlebarUserDriver() -@property (nonatomic, readonly) NSBundle *hostBundle; +@property (nonatomic, readonly) NSBundle *applicationBundle; @property (nonatomic, readonly) NSWindow *window; @property (nonatomic, nullable) SUInstallUpdateViewController *installUpdateViewController; @property (nonatomic, readonly) SPUUserDriverCoreComponent *coreComponent; @@ -27,7 +27,7 @@ @implementation SUPopUpTitlebarUserDriver -@synthesize hostBundle = _hostBundle; +@synthesize applicationBundle = _applicationBundle; @synthesize window = _window; @synthesize installUpdateViewController = _installUpdateViewController; @synthesize coreComponent = _coreComponent; @@ -39,11 +39,11 @@ @synthesize expectedContentLength = _expectedContentLength; @synthesize contentLengthDownloaded = _contentLengthDownloaded; -- (instancetype)initWithHostBundle:(NSBundle *)hostBundle window:(NSWindow *)window +- (instancetype)initWithApplicationBundle:(NSBundle *)applicationBundle window:(NSWindow *)window { self = [super init]; if (self != nil) { - _hostBundle = hostBundle; + _applicationBundle = applicationBundle; _window = window; _coreComponent = [[SPUUserDriverCoreComponent alloc] init]; _uiComponent = [[SPUUserDriverUIComponent alloc] init]; @@ -332,7 +332,7 @@ // In case our termination request fails or is delayed [self removeUpdateButton]; - [self.uiComponent terminateApplicationForBundle:self.hostBundle]; + [self.uiComponent terminateApplicationForBundle:self.applicationBundle]; }); } diff --git a/TestApplication/SUUpdateSettingsWindowController.m b/TestApplication/SUUpdateSettingsWindowController.m index 033b063d..51789682 100644 --- a/TestApplication/SUUpdateSettingsWindowController.m +++ b/TestApplication/SUUpdateSettingsWindowController.m @@ -30,13 +30,14 @@ - (void)windowDidLoad { NSBundle *hostBundle = [NSBundle mainBundle]; + NSBundle *applicationBundle = hostBundle; // If the user is holding down command, we use the popup title user driver instead id userDriver; if (([NSEvent modifierFlags] & NSCommandKeyMask) != 0) { - userDriver = [[SUPopUpTitlebarUserDriver alloc] initWithHostBundle:hostBundle window:self.window]; + userDriver = [[SUPopUpTitlebarUserDriver alloc] initWithApplicationBundle:applicationBundle window:self.window]; } else { - userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:hostBundle delegate:nil]; + userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:hostBundle applicationBundle:applicationBundle delegate:nil]; } self.userDriver = userDriver;