[Pythonmac-SIG] FInfo object - how to make invisible files?

Jack Jansen jack@oratrix.nl
Thu, 20 Apr 2000 23:56:59 +0200


Recently, Craig Hagerman <craig@osa.att.ne.jp> said:
> I understand that I have to use the macfs module as well to set the flags
> for invisible but I can't seem to get it right. I think that I have to
> create a FInfo object and then use the
> 	finfo.Flags
> method. From the Apple developer web site I seem to remember that 17
> represents invisible files (?). BUT... what exactly IS an "FInfo" object. I
> have been searching and searching to no avail. How do I set the flags of a
> file to invisible?
  import macfs, MACFS
  fss = macfs.FSSpec("thefile")
  finfo = fss.GetFInfo()
  finfo.Flags = finfo.Flags | MACFS.kIsInvisible
  fss.SetFInfo(finfo)
  
> Also; Is it possible to specify the file type/creator when I open a new
> file? or do I have to open it then use=>
> 	macfs.SetCreatorType(creator,type)
> to do this?

No. I've been at the point of doing this various times, but because it 
would make open() incompatible with non-Macintosh Pythons I've so far
refrained from doing it. You're stuck with the SetCreatorType calls,
so. Note that you'l also have to tell the finder about the change, for 
reasons I don't fully understand, otherwise it can take a long time
for the change to appear. I think findertools.touched() is the call to 
do, but have a look at something like BuildApplet.py which uses this.
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm