From e6d1e53fee326dcd6eff7a4ecdba37f851896855 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 3 Nov 2025 11:24:09 +0100 Subject: [PATCH 40/48] add backwards compatible implementation again --- src/osx/core/mimetype.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/osx/core/mimetype.cpp b/src/osx/core/mimetype.cpp index e60f105a4f..0aec5f1dd8 100644 --- a/src/osx/core/mimetype.cpp +++ b/src/osx/core/mimetype.cpp @@ -426,7 +426,17 @@ void wxMimeTypesManagerImpl::LoadDisplayDataForUti(const wxString& uti) wxCFStringRef ext = UTTypeCopyPreferredTagWithClass( cfuti, kUTTagClassFilenameExtension ); // Look up the preferred application - wxCFRef appUrl = LSCopyDefaultApplicationURLForContentType( cfuti, kLSRolesAll, nullptr); + wxCFRef appUrl; +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10 + CFURLRef aurl; + // THIS FUNCTION, DESPITE ITS NAME, RETAINS THE URL REFERENCE ON BEHALF OF THE CALLER. + OSStatus status = LSGetApplicationForInfo( kLSUnknownType, kLSUnknownCreator, ext, kLSRolesAll, NULL, &aurl ); + if( status != noErr ) + return; + appUrl.reset(aurl); +#else + appUrl.reset(LSCopyDefaultApplicationURLForContentType( cfuti, kLSRolesAll, nullptr)); +#endif if( !appUrl ) return; -- 2.24.3 (Apple Git-128)