LSSetExtensionHiddenForURL(_:_:)
Specifies whether to show or hide the filename extension for an item with a URL.
Declaration
func LSSetExtensionHiddenForURL(_ inURL: CFURL!, _ inHide: Bool) -> OSStatusParameters
- inFileURL:
A Core Foundation URL reference designating the item whose filename extension is to be hidden or shown; see the CFURL Reference in the Core Foundation Reference Documentation for a description of the
CFURLRefdata type. The URL must have schemefileand contain a valid path to either a file or a directory. - inHide:
A Boolean value specifying whether the extension should be hidden (
true) or shown (false).
Return Value
A result code; see Result Codes. The function will return the result code kLSCannotSetInfoErr if:
The extension is not valid (contains spaces)
The extension is not active (is not claimed by an application registered with Launch Services)
Hiding the extension would make the filename appear to have an active but incorrect extension (for example, in the filename
Photo.jpeg.scpt, where hiding the extension would make an AppleScript file appear to be a JPEG file)
Discussion
This function sets the necessary file-system state controlling whether the filename extension should be hidden in the display name of the item designated by the inFileURL parameter. To determine whether an item’s extension is currently hidden, you can use the LSCopyItemInfoForURL function.
Version-Notes
Thread-safe since Mac OS version 10.2.
See Also
Deprecated Functions
LSGetHandlerOptionsForContentType(_:)LSSetHandlerOptionsForContentType(_:_:)LSCopyAllHandlersForURLScheme(_:)LSCopyDefaultHandlerForURLScheme(_:)LSGetApplicationForItem(_:_:_:_:)LSGetApplicationForURL(_:_:_:_:)LSGetApplicationForInfo(_:_:_:_:_:_:)LSCopyApplicationForMIMEType(_:_:_:)LSCanRefAcceptItem(_:_:_:_:_:)LSFindApplicationForInfo(_:_:_:_:_:)LSOpenApplication(_:_:)LSOpenItemsWithRole(_:_:_:_:_:_:_:)LSOpenURLsWithRole(_:_:_:_:_:_:)LSOpenFSRef(_:_:)LSOpenFromRefSpec(_:_:)LSCopyItemInfoForRef(_:_:_:)LSCopyItemInfoForURL(_:_:_:)LSCopyDisplayNameForRef(_:_:)LSCopyDisplayNameForURL(_:_:)LSCopyKindStringForRef(_:_:)LSCopyKindStringForURL(_:_:)LSCopyKindStringForTypeInfo(_:_:_:_:)LSCopyKindStringForMIMEType(_:_:)LSCopyItemAttribute(_:_:_:_:)LSCopyItemAttributes(_:_:_:_:)LSGetExtensionInfo(_:_:_:)LSSetExtensionHiddenForRef(_:_:)LSRegisterFSRef(_:_:)