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

Re: [MacPerl] more info from FSpGetFInfo



At 18.33 1998.02.25, Axel Rose wrote:
>Just wondering whether the additional stat() could be
>saved if FSpGetFInfo() could return creation time,
>modification time and size.
>
>I have no idea if this is a limitation in the Toolbox
>call.
>If not this is just a suggestion for extending FSpGetFInfo
>for the author (Matthias?).

Well, what the FInfo object provides is all in the documentation:

    FInfo

         Information for a file, including:

            OSType          fdType          the type of the file
            OSType          fdCreator       file's creator
            U16             fdFlags         flags ex.
hasbundle,invisible,locked, etc.
            Point           fdLocation      file's location in folder

Anyway, you can also use FSpGetCatInfo instead, which offers other fields.

creation time   ioFlCrDat
mod time        ioFlMdDat

Size is really tricky.  Depends on what you really want.  Usually, you want
to add the resource and data forks together, which would be:

ioFlLgLen + ioFlRLgLen

  #!perl -w
  use Mac::Files;
  $x = 'PowerPudgeII:Desktop Folder:moovs:movies.pl';
  $y = FSpGetCatInfo($x);
  printf "$x (%s bytes)\n  created:  %s\n  modified: %s\n",
    ($y->ioFlLgLen() + $y->ioFlRLgLen()),
    scalar localtime($y->ioFlCrDat()),
    scalar localtime($y->ioFlMdDat());

Returns:

  PowerPudgeII:Desktop Folder:moovs:movies.pl (1123 bytes)
    created:  Sat Feb 21 18:12:03 1998
    modified: Sat Feb 21 18:36:50 1998

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==               New Book:  MacPerl: Power and Ease               ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#



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