summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-06-14 16:26:44 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-07-17 10:02:36 +0000
commit4629bd39a2962c9a8278ce091ce3facfab33523d (patch)
treeee011289036e7f020d33ee0e0a65e5efc76f672e /src
parent170be41178fcbee405e4abc361c6aaf726dad5db (diff)
macOS: Detect sandboxed state for command line apps
The documentation says that if we "pass a URL to the main executable of a bundle, the bundle as a whole is generally recognized.". By passing the executable instead of the bundle we include command line applications that don't have a app bundle folder (but have an embedded Info.plist). Change-Id: I3a2f145c1ec6e16607e9c04baf08678d5dea0b81 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 20f835329a35651c720b73a8d217e3b48ebd2fcf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qcore_mac.mm4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/kernel/qcore_mac.mm b/src/corelib/kernel/qcore_mac.mm
index a063fab371..9db5bd5125 100644
--- a/src/corelib/kernel/qcore_mac.mm
+++ b/src/corelib/kernel/qcore_mac.mm
@@ -386,8 +386,8 @@ bool qt_apple_isSandboxed()
{
static bool isSandboxed = []() {
QCFType<SecStaticCodeRef> staticCode = nullptr;
- NSURL *bundleUrl = [[NSBundle mainBundle] bundleURL];
- if (SecStaticCodeCreateWithPath((__bridge CFURLRef)bundleUrl,
+ NSURL *executableUrl = NSBundle.mainBundle.executableURL;
+ if (SecStaticCodeCreateWithPath((__bridge CFURLRef)executableUrl,
kSecCSDefaultFlags, &staticCode) != errSecSuccess)
return false;