add squirrel.mac patch for removed function

This was triggered by the macOS 12.0 deployment upgrade change.

See: https://developer.apple.com/documentation/coreservices/1444079-uttypeconformsto?language=objc
This commit is contained in:
clavin
2025-06-04 14:56:40 -06:00
committed by John Kleinschmidt
parent 89c51aa1c7
commit 45a4de6a85
2 changed files with 42 additions and 0 deletions

View File

@@ -8,3 +8,4 @@ feat_add_ability_to_prevent_version_downgrades.patch
refactor_use_non-deprecated_nskeyedarchiver_apis.patch
chore_turn_off_launchapplicationaturl_deprecation_errors_in_squirrel.patch
fix_crash_when_process_to_extract_zip_cannot_be_launched.patch
use_uttype_class_instead_of_deprecated_uttypeconformsto.patch

View File

@@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Calvin Watford <cwatford@slack-corp.com>
Date: Wed, 4 Jun 2025 14:48:32 -0600
Subject: Use UTType class instead of deprecated UTTypeConformsTo
macOS 12 removed support for the deprecated UTTypeConformsTo function. Its replacement is the dedicated UTType class in the Uniform Type Identifiers framework.
diff --git a/BUILD.gn b/BUILD.gn
index 68beb3d10580cdb747a78407c7f5bbb205825c4b..b9e871a0292eeda1f0e738329d0b510bdc3e34a0 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -227,6 +227,7 @@ mac_framework_bundle("squirrel_framework") {
"IOKit.framework",
"Security.framework",
"ServiceManagement.framework",
+ "UniformTypeIdentifiers.framework",
]
sources = squirrel_filenames.headers + squirrel_filenames.sources
diff --git a/Squirrel/SQRLUpdater.m b/Squirrel/SQRLUpdater.m
index 592c7ea51515aab96934e0117df3c8065494fa09..d156616e81e6f25a3bded30e6216b8fc311f31bc 100644
--- a/Squirrel/SQRLUpdater.m
+++ b/Squirrel/SQRLUpdater.m
@@ -21,6 +21,7 @@
#import <ReactiveObjC/EXTScope.h>
#import <ReactiveObjC/ReactiveObjC.h>
#import <sys/mount.h>
+#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
NSString * const SQRLUpdaterErrorDomain = @"SQRLUpdaterErrorDomain";
NSString * const SQRLUpdaterServerDataErrorKey = @"SQRLUpdaterServerDataErrorKey";
@@ -590,7 +591,8 @@ - (RACSignal *)updateBundleMatchingCurrentApplicationInDirectory:(NSURL *)direct
return NO;
}
- if (!UTTypeConformsTo((__bridge CFStringRef)type, kUTTypeApplicationBundle)) return NO;
+ UTType *uttype = [UTType typeWithIdentifier:type];
+ if (uttype == nil || ![uttype conformsToType:UTTypeApplicationBundle]) return NO;
NSBundle *bundle = [NSBundle bundleWithURL:URL];
if (bundle == nil) {