Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I believe if you've dragged some files around in that folder, it stores where those were. Or if you've set the folder to sort by name or date modified, etc.


Yeah, it basically maintains Finder window state.

One thing I've wondered is if this method still makes sense on modern hardware compared to keeping all that information in a centralized sqlite file or something along those lines. I could see individual files being advantageous on a slow mechanical HD where seeking through a file that could eventually grow large might pose issues, but that shouldn't be a problem on an SSD.

The main advantage I can think of that might still be relevant today is that it makes Finder window state machine-independent, so when you open a folder on two different machines it'll still open in list mode sorted by Date Modified or whatever.


It also makes the info follow around if the folder is moved, something that an externally maintained database file will have difficulties doing.


Windows has always maintained the view information in the registry. (https://www.nirsoft.net/utils/shell_bags_view.html)


I'm pretty sure it creates (used to? At least with XP) an ini file to remember the position of files in a folder if you manually arrange them, as well as to save view preferences (list, grid, tree) if you enable it per-directory.

Not sure if it's "Desktop.ini" I'm thinking about, but here's some documentation on it: https://learn.microsoft.com/en-us/windows/win32/shell/how-to...


I think Windows 7 (or thereabouts) ditched the Thumbs.db thumbnail cache file for each directory for a centralised file. Not sure what the reasoning was.


I've noticed that the .DS_Store file doesn't appear in a directory until I've clicked the triangle in a list view to see the contents of a subfolder. Then it creates one, I assume, to keep track of which subfolders are open.


Correct. If you create a new directory in the Terminal and populate it, it won't have a .DS_Store file. The Finder creates .DS_Store when you view the directory in the Finder.


Right. I would assume custom icons and labels (do those still e its?).

Basically it seems to be the replacement for the old resource fork data on non-Apple file systems.


I think you're right that .DS_Store handles labels, but custom icons are done with a second invisible file in the folder titled "Icon?" which apparently stores the icon data in its resource fork.


Labels and custom icons on files are stored in extended attributes (implemented as named forks on HFS+; not sure about APFS but the OS presents them all as xattrs regardless of FS) on the files themselves in APFS and HFS+.

Custom icons for folders are stored in a special "Icon?" hidden file, but not actually in the file's normal data-- they're in an extended attribute too.

(The xattr in question is called "com.apple.ResourceFork" and I'm presuming is structurally similar to a resource fork in classic Mac OS.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: