diff --git a/plugins/mac-syphon/syphon.m b/plugins/mac-syphon/syphon.m index a34f5eb29..8e132099f 100644 --- a/plugins/mac-syphon/syphon.m +++ b/plugins/mac-syphon/syphon.m @@ -2,6 +2,7 @@ #import #import "syphon-framework/Syphon.h" #include +#include #define LOG(level, message, ...) \ blog(level, "%s: " message, obs_source_get_name(s->source), \ @@ -621,7 +622,19 @@ static inline NSString *get_inject_application_path() { static NSString *ident = @"zakk.lol.SyphonInject"; NSWorkspace *ws = [NSWorkspace sharedWorkspace]; +#if (__MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0) + if (@available(macOS 11.0, *)) { + NSURL *url = [ws URLForApplicationWithBundleIdentifier:ident]; + return [url absoluteString]; + } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + return [ws absolutePathForAppBundleWithIdentifier:ident]; +#pragma clang diagnostic pop + } +#else return [ws absolutePathForAppBundleWithIdentifier:ident]; +#endif } static inline bool is_inject_available_in_lib_dir(NSFileManager *fm, NSURL *url) @@ -865,7 +878,24 @@ static void show_syphon_license_internal(void) return; NSWorkspace *ws = [NSWorkspace sharedWorkspace]; + +#if (__MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0) + if (@available(macOS 11.0, *)) { + NSURL *url = [NSURL + URLWithString: + [NSString + stringWithCString:path + encoding:NSUTF8StringEncoding]]; + [ws openURL:url]; + } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + [ws openFile:@(path)]; +#pragma clang diagnostic pop + } +#else [ws openFile:@(path)]; +#endif bfree(path); }