sho@gibbs.physics.purdue.edu (Sho Kuwamoto) (06/22/91)
Aliases on the mac are not glorified symbolic links. They're mutated symbolic links. Better in some ways, worse in others. CON: Aliases are not automatically resolved by the OS. If you try to open an alias from a program, you will not neccesarily open the file it points to. You might open the alias itself. The two places that the system software resolves aliases are in the Finder (double-clicking a file opens the file the alias references) and in the standard "Pick a file to open" dialog box (when the user chooses a file, the alias is resolved before passing the information to the program). This covers cases in which the user explicitly specifies the file to open. The problems occur when the program tries to open a file by itself. For example, a word processor might want to open a dictionary file. In these cases, you will explicitly need to call ResolveAlias to resolve an alias. PRO: Aliases are much more robust than symbolic links. You can make an alias to a file on your hard disk, rename the file, move it to a different directory, rename your hard disk, put the alias on a floppy, take the floppy and walk over to another mac on the same network, insert the floppy, double-click the alias, and still open the correct file. This works because aliases keep around a lot of redundant information which it can use when naive methods of finding the original file fail. As someone already said, if you try to resolve an alias to an unmounted volume, the system will ask you to insert the appropriate disk. PRO: When specifying a file from within one of your programs, you can use the Alias Manager to create an alias record instead of storing information like filename and path. An alias record is basically an alias stored in a struct in memory. A better way to say that might be to say that an alias is just a file containing one alias record. The alias record contains all the information the system uses to hunt around for the file. If you specify files by alias record in your own programs (instead of by filename) you can find the right file even if it has been renamed or moved. You can save these alias reords in resources, you can pass alias records from one program to another using AppleEvents, and so on. For example, a word processor might keep an alias record to a dictionary file. If the user renames the dictionary file or decides to move it somewhere else, the program can still open the file no problem. This alias record might be stored as a resource in a preferences file. In the Finder, aliases are made visually distinct by italicizing the name. If you do a Get Info, the info box contains a button that finds the original file, opens the folder it's in, scrolls so the icon is visible, and selects it. -Sho -- sho@physics.purdue.edu