1

I have two directories that have different names in Finder vs Terminal / "ls".

In Finder, the directory is called "Docker". If you drag-and-drop it into the Terminal, as I have just been doing in the screenshot below, the name becomes "com.docker.docker". It is still highlighted.

enter image description here

So in Terminal / "ls", the "Docker" directory is called "com.docker.docker":

$ ls -dlOe@ Library/Containers/com.docker.docker
drwxr-xr-x@ 5 patrick  staff  - 160 Dec 15 17:22 Library/Containers/com.docker.docker
        com.apple.metadata:com_apple_backup_excludeItem  61

Finder shows the Terminal / "ls" name in the "get Info" dialog as well:

enter image description here

One side-effect of this "localization" that can be seen in the above screenshot as well, is that now it is possible to have more than one directory with the same name side-by-side inside the same parent directory.

By using an Apple specific API, you can also get at the name that is shown in Finder:

$ /usr/bin/python -c "from Foundation import NSFileManager; print(NSFileManager.defaultManager().displayNameAtPath_('/Users/patrick/Library/Containers/com.docker.docker'))"
Docker

However, what I wonder, is where that information, e.g. the name "Docker" for the directory normally called "com.docker.docker", is actually stored on disk? And how can such a directory be created?

Apparently, macOS has a feature called "Directory Name Localization". An there are two kinds of it. One is the names of the "standard" folders in users home directories, e.g. "Pictures", "Movies", "Documents" etc. Those will most likely somehow be stored in a system database or config value. I do not know it but am not keen to know either. What I would like to know, though, is in what mechanisms might be at play in my particular case here. This is a standard Docker installation on macOS 11.1 . And apparently the second kind of directory name localization is in use here. With this, it seems, arbitrary directory names in the system can be "localized" as well. However, in this case, there is no "*.localized" directory inside the directory with the "localized" name ("com.docker.docker" / a.k.a. "Docker"), as described here.

My original question has been closed as a duplicate of this one. I was not fast enough to adapt it form "why" to "how", as I was quickly able to answer the "why" part myself. The "how" part seems to be more difficult though. And I would be really glad if anybody could answer it to me.

You must log in to answer this question.

Browse other questions tagged .