From 7be80a858d339006113c404685f2a87c32e52acf Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 9 Jul 2020 16:11:14 +0200 Subject: [PATCH] Replace deprecated LSGetApplicationForInfo() --- src/osx/core/mimetype.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/osx/core/mimetype.cpp b/src/osx/core/mimetype.cpp index 1ad1c4b316..d2da1d5937 100644 --- a/src/osx/core/mimetype.cpp +++ b/src/osx/core/mimetype.cpp @@ -426,16 +426,14 @@ void wxMimeTypesManagerImpl::LoadDisplayDataForUti(const wxString& uti) const static wxCFStringRef descKey( "CFBundleTypeName" ); const static wxCFStringRef iconKey( "CFBundleTypeIconFile" ); - // The call for finding the preferred application for a UTI is LSCopyDefaultRoleHandlerForContentType - // This returns an empty string on OS X 10.5 - // Instead it is necessary to get the primary extension and use LSGetApplicationForInfo - wxCFStringRef ext = UTTypeCopyPreferredTagWithClass( wxCFStringRef( uti ), kUTTagClassFilenameExtension ); + wxCFStringRef cfuti(uti); + + wxCFStringRef ext = UTTypeCopyPreferredTagWithClass( cfuti, kUTTagClassFilenameExtension ); // Look up the preferred application - CFURLRef appUrl; - OSStatus status = LSGetApplicationForInfo( kLSUnknownType, kLSUnknownCreator, ext, kLSRolesAll, NULL, &appUrl ); + wxCFRef appUrl = LSCopyDefaultApplicationURLForContentType( cfuti, kLSRolesAll, NULL); - if( status != noErr ) + if( !appUrl ) return; // Create a bundle object for that application