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