[macOS, Mono] Fix "Wdeprecated-declarations" build error.

(cherry picked from commit 5d54c015b2)
This commit is contained in:
bruvzg 2020-07-10 18:45:12 +03:00 committed by Rémi Verschelde
parent 9d0d9ff424
commit 12e10457e1

View File

@ -38,24 +38,21 @@
#include <CoreServices/CoreServices.h> #include <CoreServices/CoreServices.h>
bool osx_is_app_bundle_installed(const String &p_bundle_id) { bool osx_is_app_bundle_installed(const String &p_bundle_id) {
CFURLRef app_url = NULL; CFStringRef bundle_id = CFStringCreateWithCString(nullptr, p_bundle_id.utf8(), kCFStringEncodingUTF8);
CFStringRef bundle_id = CFStringCreateWithCString(NULL, p_bundle_id.utf8(), kCFStringEncodingUTF8); CFArrayRef result = LSCopyApplicationURLsForBundleIdentifier(bundle_id, nullptr);
OSStatus result = LSFindApplicationForInfo(kLSUnknownCreator, bundle_id, NULL, NULL, &app_url);
CFRelease(bundle_id); CFRelease(bundle_id);
if (app_url) if (result) {
CFRelease(app_url); if (CFArrayGetCount(result) > 0) {
CFRelease(result);
switch (result) {
case noErr:
return true; return true;
case kLSApplicationNotFoundErr: } else {
break; CFRelease(result);
default: return false;
break; }
} else {
return false;
} }
return false;
} }
#endif #endif