Re: Difference between "as alias" and "as file specification"?
Re: Difference between "as alias" and "as file specification"?
- Subject: Re: Difference between "as alias" and "as file specification"?
- From: Chris Page <email@hidden>
- Date: Wed, 12 Dec 2001 15:13:21 -0800
nigh on 2001-12-12 1:46 PM, Greg Back at email@hidden wrote:
>
The subject says it all. i've seen both forms used, and i'd like to know the
>
difference. I think this has been asked before, but i couldn't find it on
>
the archives. I also looked in the ASLG, but couldn't find anything. I use
>
the two interchangeably and have never run into any problems. Would anyone
>
like to satisfy my never-ending curiosity by relating an answer to me?
An alias is an alias record, like the kind that is stored in an alias file.
Aliases contain a lot of information about where the file was, and if it
moves, the alias will still point to it in a lot of cases. Alias records are
persistent and can be used across processes.
File specifications are FSSpec records, which consist of a volume reference
number, parent directory ID, and item name. They refer to a particular item
in a particular directory on a particular volume. If the item is renamed or
moved, the file specification will no longer allow you to locate it. They
are only valid in the current process. You can't store one in a file and
read it back in a separate invocation of your app and expect it to work, and
you can't send it to another process and have it use it[*]. They cannot be
created from within AppleScript -- they can be created by OSAXen and
scriptable applications.
So, generally you want to use aliases. File specifications can be faster to
resolve, but you really only want to use them for short durations.
[*] The restriction about passing them from process to process is a new one,
imposed by Mac OS X. On Mac OS 9, you could do this, but it's a bad idea to
rely on this behavior going forward.
--
Chris Page
Mac OS Lead, Palm Desktop
Palm, Inc.
Lern 2 spel.