I found a type script that mimics the file command in unix. It uses 'magic' to figure out the type -- where magic is a code in most files that identify what it is. So I would google for those pieces of info and your bound to come up with it. Mine is heavily hacked up for my purposes so mine wont be al that useful to you.

Ray Slakinski

On 10-Feb-05, at 6:19 AM, Enrico Franchi wrote:

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

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to