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). Pick-to: 6.2 6.1 5.15 Change-Id: I3a2f145c1ec6e16607e9c04baf08678d5dea0b81 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
01ff216c82
commit
20f835329a
@ -401,8 +401,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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user