aliases/ln -s


Don't Tread on Me!
I had made some aliases from my documents file in OS 9 to a document directory in my OSX user directory. I thought this way my documents would be in sync between each OS. It works fine at the GUI level, but the terminal sees the alias as a file and not a directory. Because of this I can not cd to the aliased directory. I then deleted the alias an created a link in the terminal using the ln -s command to the Documents directory, but then this does not work well in the GUI.

Is there a way to get the terminal to recognize an aliased directory as a link to that directory so that I can cd to it?:confused:

Unfortunately I don't think so.

An alias is an arbitrary description of how to get a file. It's different depending on the filesystem (HFS, UFS, AppleShare, etc.) and has to be resolved using the Alias Manager which unfortunately is still in Carbon. The alias data can be in a file (what we see as an alias in the Finder), an XML property (like Internet Config prefs), or an 'alis' resource, or anywhere really.

Ideally the Alias Manager would be a separate library, perhaps using CF interfaces. Resolving an alias would result in a CFURL (or preferably a new object analogous to a CFFSRef).

Since the Alias Manager is locked up in Carbon, resolving them would require linking to it which I don't think anybody wants.

It's a pity too. The great thing about the alias is you can have redundancy in terms of hints how to find a file. If this were a separate open source library, or a library with a CFPlugin architecture for loading new 'alias resolvers' you could fine tune when and where an alias should break. One kind of alias could point to an inode (like a hard link), another a path (like a symbolic link) or another a file name and the fileID of the host directory.