[comp.sys.mac.programmer] Unlocking a File

mikeoro@hubcap.clemson.edu (Michael K O'Rourke) (11/20/89)

I was recently playing around with trying to unlock a file with the
file manager.  I was using PBGetCatInfo to go thru directories, so i 
thought i'd used PBSetCatInfo to set the file lock.  Seeing as how
the ioFlAttrib field will tell you if a file is locked, i figured i
could just turn off the locked bit and the do a PBSetCatInfo and the file
would then be unlocked. No such luck.  I ended up finding out about and
using PBRstFLock.

Why didn't the PBSetCatInfo call work?  What if i had wanted to change one
of the ioFlAttrib bits other than the locked bit.  What would i have been
able to do then?  Is there some little trick to using PBSetCatInfo for
this?

Thanx,
Michael O'Rourke

tim@hoptoad.uucp (Tim Maroney) (11/22/89)

In article <7135@hubcap.clemson.edu> mikeoro@hubcap.clemson.edu (Michael
K O'Rourke) writes:
>I was using PBGetCatInfo to go thru directories, so i 
>thought i'd used PBSetCatInfo to set the file lock.  Seeing as how
>the ioFlAttrib field will tell you if a file is locked, i figured i
>could just turn off the locked bit and the do a PBSetCatInfo and the file
>would then be unlocked. No such luck.  I ended up finding out about and
>using PBRstFLock.
>
>Why didn't the PBSetCatInfo call work?  What if i had wanted to change one
>of the ioFlAttrib bits other than the locked bit.  What would i have been
>able to do then?  Is there some little trick to using PBSetCatInfo for
>this?

I think it's a documentation bug that lists ioFlAttrib as an input field
to PBSetCatInfo.  Look at all the flags; you can't meaningfully set *any*
of them except lock, and you've just shown that the single presumably
settable bit doesn't work either.  What sense would it make to set the
bits that tell you whether or not a file is open, or if a file is a
real file or a folder?  So just cross out ioFlAttrib on page IM IV-156.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"The function of art is to try to purge us of the Beast through laughter
 and terror.  Coppola, like Dostoyevsky's Grand Inquisitor, seems to
 want to saddle and mount the beast." -- Jeff Meyer