Replace deprecated LSGetApplicationForInfo()
This commit is contained in:
committed by
Vadim Zeitlin
parent
c53e9d913b
commit
7be80a858d
@@ -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<CFURLRef> appUrl = LSCopyDefaultApplicationURLForContentType( cfuti, kLSRolesAll, NULL);
|
||||
|
||||
if( status != noErr )
|
||||
if( !appUrl )
|
||||
return;
|
||||
|
||||
// Create a bundle object for that application
|
||||
|
Reference in New Issue
Block a user