[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] not following aliases



At 3:36 PM -0600 3/10/99, Chris Nandor wrote:
>At 12.10 -0500 1999.03.10, Dave Lorand wrote:
>>That's half of it.  My other question is, which of the toolbox calls I'm
>>making will cause the alias to be followed?  I'd like to get as much info
>>as I can on aliases without actually following them.
>
>I think all of them will get info on the aliased-to file, not the alias
>itself.
>
>You can get some of the data you want with the lstat command.  That will
>give you the size of the alias, anyway.  Here is a way using File::stat:
>
>    $size = -l $_ ? lstat($_)->size : stat($_)->size;
>
>I noticed that CatInfo will return data for an alias file instead of its
>target if the alias file is opened in ResEdit.  I don't know of a way to
>exploit that here, though.

It looks like I've got a solution, for those of you who are curious.  Most
of those toolbox calls were gathering information which I didn't really
need for aliases anyway.  The listing I gather is used to figure out what
has changed in a folder, but those data are about the target of an alias,
not the alias itself.  If the target of an alias changes, we wouldn't say
that the alias itself has changed.

The information which is useful for checking whether an alias has changed
(IMHO) are its size and its target.  It might also be useful to check type,
creator, creation date, and modification date, but size and target will do
for me.

I used Chris' suggestion of -l for determining whether the file is an alias
in te first place.  If it is, I get its size with "lstat($pathname)->size"
as Chris suggested above.  I get its target using readlink, which was
ported perfectly.  That's all!

Thanks, Chris.

Dave

P.S. I can make the final scripts available if people are interested in
them.  Let me know if you are.
 ____________________________________________________________
| Dave Lorand, Programmer/Analyst   | davel@src.uchicago.edu |
| Social Science Research Computing | 773-702-3792           |
| University of Chicago             | 773-702-2101 (fax)     |
+-----------------------------------+------------------------+
 ---> finger davel@cicero.src.uchicago.edu for my PGP key <--

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org