Saturday, May 21, 2005

I guessed wrong

I was browsing around my home directory this evening, using the Terminal. (Are Apple and Microsoft having a competition to see who can co-opt the most generic words?) Looking in ~/Desktop, I was pretty sure I knew how desktop folder aliases were going to work. For example, on my desktop I have an alias called Documents which points at ~/Documents.

documents folder

I was confident that 'ls -l Desktop/Documents' would yield something like:
lrwxr-xr-x 1 paulh paulh 9 May 21 18:22 Documents -> 
(That line is wrapped for readability.) That is, that Documents in ~/Desktop would be a genuine, bona fide Unix symbolic link. It's not. It's an empty file:
-rw-r--r-- 1 paulh paulh 0 May 17 22:58 Documents
What's going on here? An 'ls -al' shows a couple of possible candidates for an explanation:
-rw------- 1 paulh  paulh  6148 May 21 18:23 .DS_Store
-rw-r--r-- 1 paulh paulh 0 May 13 14:24 .localized
Since .localized is empty, I'm looking at .DS_Store. This didn't help:
$ file .DS_Store
.DS_Store: data
Yeah, thanks file. Nor did this:
$ strings .DS_Store 
Fascinating, but not useful. Interestingly, making a symlink in ~/Desktop does do just what I thought it would:
$ ln -s ../Documents Symlink

symlink folder

So, what's going on? Am I close with .DS_Store? Or is the magic elsewhere?

1 comment:

  1. Resource forks, which are now extended attributes in 10.4.