[Pythonmac-SIG] Method to lock/unlock files

Jack Jansen Jack.Jansen@cwi.nl
Fri, 26 Apr 2002 10:53:04 +0200


On Friday, April 26, 2002, at 04:15 , Mike Nardell wrote:

>
>>>> import macfs
>>>> myFSSpec = macfs.FSSpec ("someTestFile")
>>>> myInfo = myFSSpec.GetFInfo()
>>>> myInfo.Flags
> 256
>
> Now, the fact that I am clueless as to what 256 means, should tell me 
> that I
> need to read _Inside Macintosh: Files_. What makes me a bit confused is 
> that
> this Flags field remains unchanged after I have gone in and (using the 
> File
> Info DB ) changed the file from being unlocked to locked.

This is strange. The "256" sounds reasonable (look at the top of 
:Mac:Lib:MACFS.py for the bits in the Flags field), but it should change 
if you set the lock bit (4096 should be added). You should however call 
GetFInfo() again, of course, the structure isn't updated live.

To make matters worse all this doesn't seem to work on OSX. I always get 
"0" back in the flags, and I can set whatever I want without effect. And 
I don't think this is a Python problem: xFiles (a utility to look at 
mode bits and finfo bits) also doesn't see changes made in the finder 
info window...
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma 
Goldman -