Trying to understand the locking of a file

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:jem@mostrom.pp.se
Free Elektron                      http://www.mostrom.pp.se/folk/jem/
0
lists
2/27/2001 3:51:21 PM
perl.macperl 876 articles. 0 followers. Follow

0 Replies
194 Views

Similar Articles

[PageSpeed] 54

Reply: