Search code examples
objective-cnsurl

What exactly NSURLLocalizedNameKey resource returns and is it different from the url's last path component?


NSURL provides a method getResourceValue:forKey:error:. One of the possible keys is the NSURLLocalizedNameKey which from documentation returns:

The resource’s localized or extension-hidden name, returned as an NSString object (read-only).

What does it mean "localized or extension-hidden name"? Is it different from just calling [url lastPathComponent]?


Solution

    • localized means you get for example Desktop on an English system, Schreibtisch in German or デスクトップ in Japanese.
    • extension-hidden considers the checkbox in a Finder Info window like

      enter image description here

    lastPathComponent returns always the internal non-localized full file/folder name.