Attachment "1ccface1c510-alt.diff" to
ticket [1ccface1]
added by
chrstphrchvz
2022-09-21 18:50:31.
diff --git macosx/tkMacOSXFileTypes.c macosx/tkMacOSXFileTypes.c
index c5beb67ad..445f0fa5b 100644
--- macosx/tkMacOSXFileTypes.c
+++ macosx/tkMacOSXFileTypes.c
@@ -71,10 +71,10 @@ MODULE_SCOPE NSString *TkMacOSXOSTypeToUTI(OSType ostype) {
*/
MODULE_SCOPE NSImage *TkMacOSXIconForFileType(NSString *filetype) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
if (!initialized) {
initOSTypeTable();
}
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
if (@available(macOS 11.0, *)) {
UTType *uttype = [UTType typeWithIdentifier: filetype];
if (uttype == nil || !uttype.isDeclared) {
@@ -91,15 +91,9 @@ MODULE_SCOPE NSImage *TkMacOSXIconForFileType(NSString *filetype) {
return nil;
}
return [[NSWorkspace sharedWorkspace] iconForContentType:uttype];
- } else {
-/* Despite Apple's claims, @available does not prevent deprecation warnings. */
+ }
+#endif
# if MAC_OS_X_VERSION_MIN_REQUIRED < 110000
- return [[NSWorkspace sharedWorkspace] iconForFileType:filetype];
-#else
- return nil; /* Never executed. */
-#endif
- }
-#else /* @available is not available. */
return [[NSWorkspace sharedWorkspace] iconForFileType:filetype];
#endif
}