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

[MacPerl-Toolbox] StandardFile filters



How can I get, from the CatInfo passed to a SF file filter procedure, to
something I can pass to open()?

This is my attempt, but FSMakeFSSpec is saying "file not found"; and it seems
suspicious to me that $info->ioDirID is different for each file.

#!perl -w

use Mac::StandardFile;
use Mac::Files;

print "Test\n";

    my $res = StandardGetFile( sub {
      my ($info) = @_;
      my $spec = FSMakeFSSpec($info->ioVRefNum, $info->ioDirID,
$info->ioNamePtr)
        or print "($^E)\n";
      print join("|", $info->ioVRefNum, $info->ioDirID, $info->ioNamePtr), "\n";
      local *FILE;
      open FILE, "< $spec" or return 1;
      my $str;
      read FILE, $str, 1 or return 1;
      close FILE;
      return ($str eq '#') ? 0 : 1;
    }, -1);
print $res->sfFile, "\n" if $res->sfGood;

__END__

-- 
 Kevin Reid: |    Macintosh:      
  "I'm me."  | Think different.

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