[Pythonmac-SIG] How do you use macfs.FInfo?

Jack Jansen jack@oratrix.nl
Mon, 11 Oct 1999 11:54:49 +0200


> On Sat, Oct 9, 1999, Richard Gordon <richard@richardgordon.net> wrote:
> 
> >Anyway, naturally I'm now stuck. I gathered that what I wanted to use 
> >was macfs.FInfo, but I have yet to figure it out. The Python 
> >documentation deals with this in Sec. 7.3 and says that the FInfo 
> >Objects include:
> >
> >Creator
> >        The 4-character creator code of the file.
> >
> >That's all well and good, but when I try to use this, I just get
> >
> >>>> macfs.FInfo(thefile)
> ><FInfo object at 300e0c0>
> 
> You need to use the macfs module, create an FSSpec object for the file,
> then use the SetCreatorType method of the file's FSSpec object. For example:
> 
> import macfs
> 
> offs = macfs.FSSpec('sample.jpg')
> offs.SetCreatorType('JVWR', 'JPEG')

That works, but that doesn't use a FInfo object. It is the old method of 
setting creator/type, and while I would love to depracate it in favor of using 
FInfo it is used too often by too many people (including me:-)

> >I'd appreciate any explanations about this and, while we're at it, 
> >what's the deal with FInfoType?
> 
> My documentation states that the Finfo method creates a zero-filled FInfo
> object. This is clearly not what you want. I'm not sure what one would
> use the FInfo object type for, but I'm new to Mac programming too.

A FInfo object holds all Finder Information of a file: not only creator and 
type but also icon position, flags, etc. The calls are
  fsspec.GetFInfo() -> FInfo object for the file
  fsspec.SetFInfo(finfo) Sets finder info
Since occasionaly you need an empty finder info object there's also the 
FInfo() call to create an empty one.

All the finder information is in attributes of the finfo object.
--
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