[Pythonmac-SIG] Discovering file type

Enrico Franchi riko at anubics.org
Thu Feb 10 12:19:10 CET 2005


I need to write a function that gets a filepath and gives back what 
kind of file is that in a consistent way.

I thought i could use my beloved old TYPE and CREATOR, then I realized 
that in MacOS X not every file has got them.
So i can check both the extension and the HFSFileType.

Still i need a consistent way to express the file type. I need 
something that given an HFSFileType returns the 'most used' extension, 
or something that from an extension determines a file type.
Is there anything like that?

Thanks in advance.

-enrico



More information about the Pythonmac-SIG mailing list