[Pythonmac-SIG] Replacing macfs.StandardGetFile and friends.

Nick Matsakis matsakis@mit.edu
Thu, 16 Jan 2003 10:09:35 -0500 (EST)


On Thu, 16 Jan 2003, Jack Jansen wrote:

> - typelist: a list of 4-char filetypes that are acceptable
> (AskFileForOpen only). Do we need another interface, such as extensions?
> Mimetypes?

>From day one, Mac OS X has needed a system-wide database that translates
between HFS type codes, MIME types, and filename extensions (with the
latter one being configurable).  I hope that one day we will have this.

It would be very cool if Python on the Mac provided the functionality for
a programmer to specify the file type(s) as either a MIME type or HFS code
and have the system work it out.  Though creating and maintaining a
database of all file type information is daunting, restricting the scope
to just those file types that are MIME standards would be doable (there
are only a few dozen standard MIME types).  And, if Apple or someone else
ever releases a more exhaustive database you can just use that without
changing the API.

Generally, I'm very much against filename extensions for reasons I won't
go into here except to say that there is no centralized registry for
guaranteeing them to be unique.  However, given the poor treatment that
Apple has given this problem, there are a great many files out there whose
type information is exclusively available as a filename extension.  For
this reason, the MacPython APIs should also provide the ability to select
based on extension as well.

Nick Matsakis