[Pythonmac-SIG] unlock a file?

Doug Wyatt doug@sonosphere.com
Fri, 21 Apr 2000 14:30:59 -0400


At 11:21 -0700 4/21/00, Rob Managan wrote:
>Jack just mentioned about how to set the file info.
>   import macfs, MACFS
>   fss = macfs.FSSpec("thefile")
>   finfo = fss.GetFInfo()
>   finfo.Flags = finfo.Flags | MACFS.kIsInvisible
>   fss.SetFInfo(finfo)
>
>  One of the finder flags controls whether the file is locked or not. It is bit
>
>kNameLocked = 0x1000
>
>of that integer.
>
>So you should be able to get the file info, change that bit and then 
>set the file info. Not sure about telling the finder about the 
>change. You can always close and open the folder to force an update.

I looked at that, but the FInfo.Flags of my locked file is 0.

Apparently this finder "name locked" bit is independent of the actual 
lock bit accessed via ParamBlock.fileParam.ioFlAttrib & 1.

Just's method looks like it will work, but I've realized I need to 
interrogate the lock bit first (gonna put it back after munging the 
file), so I used this an excuse to clean up a one-shot extension 
module I wrote once and call it "myfileutils."

Thanks though.

Doug


-- 
Doug Wyatt                             doug@sonosphere.com
http://www.sonosphere.com/