Function

LSCopyKindStringForTypeInfo(_:_:_:_:)

Obtains a kind string for items with a specified file type, creator signature, filename extension, or any combination of these characteristics.

Declaration

func LSCopyKindStringForTypeInfo(_ inType: OSType, _ inCreator: OSType, _ inExtension: CFString!, _ outKindString: UnsafeMutablePointer<Unmanaged<CFString>?>!) -> OSStatus

Parameters

inType

The file type to consider. Comparison of file types is case-sensitive. Pass kLSUnknownType if the items’ file type is unimportant.

inCreator

The creator signature to consider. Comparison of creator signatures is case-sensitive. Pass kLSUnknownCreator if the items’ creator signature is unimportant.

inExtension

A Core Foundation string object specifying the filename extension to consider; see the CFString Reference in the Core Foundation Reference Documentation for a description of the CFStringRef data type. Comparison of filename extensions is case-insensitive. Pass NULL if the items’ filename extension is unimportant.

outKindString

A pointer to a Core Foundation string object that, on return, will contain the requested kind string; see the CFString Reference in the Core Foundation Reference Documentation for a description of the CFStringRef data type. You are responsible for releasing this object.

Return Value

A result code; see Result Codes.

Discussion

This function obtains the kind string that most closely describes items having the specified characteristics. It is useful when you want to display the kind string for a document you do not yet have (such as an email attachment).

You can request any combination of one, two, or all three of the characteristics specified by the inType, inCreator, and inExtension parameters; at least one of these characteristics must be supplied. The kind string (which may be localized) is obtained from the preferred application for opening such items, if one is found in the Launch Services database; otherwise, a more generic kind string is chosen. For example, the kind string might be FrameMaker Document, or just Document if no suitable application is found.

Note that since the choice of a preferred application is subject to any document binding preferences the user may have set, the kind string will not necessarily be obtained from the default application that matches the specified creator signature (if any), but may instead be taken from a user-specified application that overrides the default. For example, if the user has specified that files of type 'PDF ' and creator 'ACRO' should be opened in the Preview application rather than in Acrobat, the kind string for this combination of characteristics will be that defined for 'PDF ' files by Preview and not by Acrobat.

Version-Notes

Thread-safe since Mac OS version 10.2

See Also

Obtaining Information About an Item

func LSCopyItemInfoForRef(UnsafePointer<FSRef>!, LSRequestedInfo, UnsafeMutablePointer<LSItemInfoRecord>!) -> OSStatus

Obtains requested information about an item designated by file-system reference.

Deprecated
func LSCopyItemInfoForURL(CFURL!, LSRequestedInfo, UnsafeMutablePointer<LSItemInfoRecord>!) -> OSStatus

Obtains requested information about an item designated by URL.

Deprecated
func LSCopyDisplayNameForRef(UnsafePointer<FSRef>!, UnsafeMutablePointer<Unmanaged<CFString>?>!) -> OSStatus

Obtains the display name for an item designated by file-system reference.

Deprecated
func LSCopyDisplayNameForURL(CFURL!, UnsafeMutablePointer<Unmanaged<CFString>?>!) -> OSStatus

Obtains the display name for an item designated by URL.

Deprecated
func LSCopyKindStringForRef(UnsafePointer<FSRef>!, UnsafeMutablePointer<Unmanaged<CFString>?>!) -> OSStatus

Obtains the kind string for an item designated by file-system reference.

Deprecated
func LSCopyKindStringForURL(CFURL!, UnsafeMutablePointer<Unmanaged<CFString>?>!) -> OSStatus

Obtains the kind string for an item designated by URL.

Deprecated