improved updater logic

This commit is contained in:
Patrick Wardle 2021-05-07 23:45:56 -04:00
parent 7a7d8f20ea
commit 9a6ee5811f
2 changed files with 24 additions and 8 deletions

View File

@ -395,10 +395,6 @@ bail:
//init app dest //init app dest
applicationDest = [@"/Applications" stringByAppendingPathComponent:APP_NAME]; applicationDest = [@"/Applications" stringByAppendingPathComponent:APP_NAME];
//remove xattrs
// otherwise app translocation may causes issues
execTask(XATTR, @[@"-rc", applicationDest], YES, NO);
//copy //copy
if(YES != [NSFileManager.defaultManager copyItemAtPath:applicationSrc toPath:applicationDest error:&error]) if(YES != [NSFileManager.defaultManager copyItemAtPath:applicationSrc toPath:applicationDest error:&error])
{ {
@ -412,6 +408,13 @@ bail:
//dbg msg //dbg msg
os_log_debug(logHandle, "copied %{public}@ -> %{public}@", applicationSrc, applicationDest); os_log_debug(logHandle, "copied %{public}@ -> %{public}@", applicationSrc, applicationDest);
//remove xattrs
// otherwise app translocation may causes issues
execTask(XATTR, @[@"-rc", applicationDest], YES, NO);
//dbg msg
os_log_debug(logHandle, "removed %{public}@'s xattrs", applicationDest);
//happy //happy
wasInstalled = YES; wasInstalled = YES;

View File

@ -139,6 +139,12 @@ extern os_log_t logHandle;
//action //action
NSInteger action = 0; NSInteger action = 0;
//app path
NSURL* appPath = nil;
//error
NSError* error = nil;
//grab tag //grab tag
action = ((NSButton*)sender).tag; action = ((NSButton*)sender).tag;
@ -206,11 +212,18 @@ extern os_log_t logHandle;
// launch helper/login item // launch helper/login item
if(YES == self.supportView.window.isVisible) if(YES == self.supportView.window.isVisible)
{ {
//dbg msg //init app path
os_log_debug(logHandle, "now launching: %@", APP_NAME); appPath = [NSURL fileURLWithPath:[@"/Applications" stringByAppendingPathComponent:APP_NAME]];
//launch helper app //dbg msg
execTask(OPEN, @[[@"/Applications" stringByAppendingPathComponent:APP_NAME], @"--args", INITIAL_LAUNCH], NO, NO); os_log_debug(logHandle, "now launching: %{public}@", appPath);
//launch it
if(nil == [[NSWorkspace sharedWorkspace] launchApplicationAtURL:appPath options:0 configuration:@{NSWorkspaceLaunchConfigurationArguments:@[INITIAL_LAUNCH]} error:&error])
{
//err msg
os_log_error(logHandle, "ERROR: failed to launch %{public}@ (error: %{public}@)", appPath, error);
}
} }
//close window //close window