diff options
author | Damiano Galassi <[email protected]> | 2019-06-09 08:21:43 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2019-06-09 08:21:43 +0200 |
commit | 435d6562b15b2236a15d9b654788dcfa1026cc45 (patch) | |
tree | 0ebbbbdb843f0ef71810eb5e5b0a2d6ed7bc3a02 /macosx/HBUtilities.m | |
parent | 727dc9879454c0aea3b2cf4aecbd54d95d8ae45b (diff) |
MacGui: make sure System Events is running, if not the permission alert will not be shown.
Diffstat (limited to 'macosx/HBUtilities.m')
-rw-r--r-- | macosx/HBUtilities.m | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/macosx/HBUtilities.m b/macosx/HBUtilities.m index 9a627bf5a..2e47a9531 100644 --- a/macosx/HBUtilities.m +++ b/macosx/HBUtilities.m @@ -395,6 +395,17 @@ enum { { const char *identifierCString = bundleIdentifier.UTF8String; AEAddressDesc addressDesc; + + if ([bundleIdentifier isEqualToString:@"com.apple.systemevents"]) + { + // Mare sure system events is running, if not the consent alert will not be shown. + BOOL result = [NSWorkspace.sharedWorkspace launchAppWithBundleIdentifier:bundleIdentifier options:0 additionalEventParamDescriptor:nil launchIdentifier:NULL]; + if (result == NO) + { + [HBUtilities writeToActivityLog:"Automation: couldn't launch %s.", bundleIdentifier.UTF8String]; + } + } + OSErr descResult = AECreateDesc(typeApplicationBundleID, identifierCString, strlen(identifierCString), &addressDesc); if (descResult == noErr) @@ -407,20 +418,20 @@ enum { switch (permission) { case errAEEventWouldRequireUserConsent: - [HBUtilities writeToActivityLog:"Request user consent for %s.", bundleIdentifier.UTF8String]; + [HBUtilities writeToActivityLog:"Automation: request user consent for %s.", bundleIdentifier.UTF8String]; result = HBPrivacyConsentStateUnknown; break; case noErr: - [HBUtilities writeToActivityLog:"Permission granted for %s.", bundleIdentifier.UTF8String]; + [HBUtilities writeToActivityLog:"Automation: permission granted for %s.", bundleIdentifier.UTF8String]; result = HBPrivacyConsentStateGranted; break; case errAEEventNotPermitted: - [HBUtilities writeToActivityLog:"Permission not granted for %s.", bundleIdentifier.UTF8String]; + [HBUtilities writeToActivityLog:"Automation: permission not granted for %s.", bundleIdentifier.UTF8String]; result = HBPrivacyConsentStateDenied; break; case procNotFound: default: - [HBUtilities writeToActivityLog:"Permission unknown."]; + [HBUtilities writeToActivityLog:"Automation: permission unknown."]; result = HBPrivacyConsentStateUnknown; break; } |