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

Re: [MacPerl] Using Toolbox modules--fss question



pudge@pobox.com (Chris Nandor) sagely responds:
>At 14.57 1998.02.23, Frederick Bruckman wrote:
>>How do you tell if a File System Spec is for a file, or a directory?

>Use -d and -f (directory and file checks).  Now, this is implemented via
>stat(), which is a bit slow.  So the second call (-f _) is a special call
>that says "do the -f check on the result of the last call to stat()", which
>in this case is "-d $thing".
>
>Also, you don't need to have MakeFSSpec() here, but that is what you asked
>about, so I put it in.
>
>#!perl -wl
>foreach (@ARGV) {
>  my $thing = MacPerl::MakeFSSpec($_);
>  print "$_ -- ", -d $thing ? 'directory' : -f _ ? 'file' : '?';
>}

Yes, thank you! -f works nicely. I asked about the FSSpec, because that's
what FSpIterateDirectory gives you.



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch