Hi again

I'm trying to understand how I can check if a file is locked or not and have
been using this code in order to check the FInfo info for a file

#!perl -w
use Mac::Files;
my($file, $fileCat, $fileInfo);

$file     = 'Central:Desktop Folder:test.pl';
$fileCat  = FSpGetCatInfo($file)     or die('Blää');
$fileInfo = $fileCat->ioFlFndrInfo() or die('Blää');


FSpSetFLock($file);

print $fileCat->ioNamePtr() . 
    " flag: " . $fileInfo->fdFlags() . 
    " type: " . $fileInfo->fdType() .
    " crea: " . $fileInfo->fdCreator() . "\n";

This works fine if I check the invisible flag, then it looks like this if a file
is invisible or not

test.pl flag: 256 type: TEXT crea: R*ch
test.pl flag: 16640 type: TEXT crea: R*ch

Checking the Mac documentation the invisible flag is bit 14 so this seems to
work. However, when try to see a difference between a locked and a unlocked file
I get the same result in both cases 

test.pl flag: 256 type: TEXT crea: R*ch
test.pl flag: 256 type: TEXT crea: R*ch

The docs says 'nameLocked' is bit 12 which made me expected that the flag value
would be 256 or 4352 ... but there seems to be no change.

Disclaimer time: I'm no Mac programmer and I'm trying to learn the inner parts
of MacPerl so I might be missing something obvious but what?

                    jem
--
Jan Erik Moström                             mailto:[EMAIL PROTECTED]
Free Elektron                      http://www.mostrom.pp.se/folk/jem/

Reply via email to