Contents

LSSetExtensionHiddenForRef(_:_:)

Specifies whether to show or hide the filename extension for an item with a file-system reference.

Declaration

func LSSetExtensionHiddenForRef(_ inRef: UnsafePointer<FSRef>!, _ inHide: Bool) -> OSStatus

Parameters

  • inRef:

    A pointer to a file-system reference designating the item whose filename extension is to be hidden or shown; see the File Manager Reference in the Carbon File Management Documentation for a description of the FSRef data type.

  • inHide:

    A Boolean value specifying whether the filename 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 inRef parameter. To determine whether an item’s extension is currently hidden, you can use the LSCopyItemInfoForRef function.

Version-Notes

Thread-safe since Mac OS version 10.2.

See Also

Deprecated Functions