From 211f930059d1b7809aec0df016ee71cef935284d Mon Sep 17 00:00:00 2001 From: Dmytro Tretiakov Date: Fri, 10 Jul 2015 15:42:38 +0300 Subject: [PATCH] Corrected relaunch of application that should make app active right after launch. --- Sparkle/Autoupdate/Autoupdate.m | 10 +++++++++- Sparkle/Installation XPC Service/install_service.m | 7 +++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Sparkle/Autoupdate/Autoupdate.m b/Sparkle/Autoupdate/Autoupdate.m index 234a99f2..1a2bdbd6 100644 --- a/Sparkle/Autoupdate/Autoupdate.m +++ b/Sparkle/Autoupdate/Autoupdate.m @@ -128,7 +128,15 @@ static const NSTimeInterval SUParentQuitCheckInterval = .25; appPath = self.executablepath; else appPath = self.installationPath; - [[NSWorkspace sharedWorkspace] openFile:appPath]; + + NSError *error = nil; + [[NSWorkspace sharedWorkspace] launchApplicationAtURL:[NSURL fileURLWithPath:appPath] + options:NSWorkspaceLaunchNewInstance + configuration:nil error:&error]; + if (error.code != noErr) + { + SULog(@"%ld - %@", error.code, error.localizedDescription); + } } if (self.folderpath) diff --git a/Sparkle/Installation XPC Service/install_service.m b/Sparkle/Installation XPC Service/install_service.m index 94bc2b8c..a10cf74f 100644 --- a/Sparkle/Installation XPC Service/install_service.m +++ b/Sparkle/Installation XPC Service/install_service.m @@ -304,9 +304,8 @@ static void peer_event_handler(xpc_connection_t peer, xpc_object_t event) else if (type == XPC_TYPE_DICTIONARY) { // Handle the message. - SUInstallServiceTask task = (SUInstallServiceTask)xpc_dictionary_get_int64(event, SUInstallServiceTaskTypeKey); - - NSLog(@"XPC Installer: should start task with id = %lld", (int64_t)task); + int64_t task = xpc_dictionary_get_int64(event, SUInstallServiceTaskTypeKey); + NSLog(@"XPC Installer: will do the task %lld", (int64_t)task); xpc_object_t reply = NULL; @@ -334,7 +333,7 @@ static void peer_event_handler(xpc_connection_t peer, xpc_object_t event) default: { - SULog(@"XPC Install Service: Unknown XPC service task %lld", (int64_t)task); + SULog(@"XPC Install Service: Unknown XPC service task %lld", task); reply = xpc_dictionary_create_reply(event); xpc_dictionary_set_int64(reply, SUInstallServiceErrorCodeKey, (int64_t)SUXPCServiceError);