[plt-scheme] Guessing the file type?

From: Amit Saha (lists.amitsaha at gmail.com)
Date: Mon Jul 27 11:11:21 EDT 2009

Marek Kubica wrote:
> Hi,
> 
> On Mon, 27 Jul 2009 09:24:23 +0530
> Amit Saha <lists.amitsaha at gmail.com> wrote:
> 
>> Great. On my Ubuntu Linux:
>>
>>  > ((make-path->mime-type "/etc/mime.types") (build-path 
>> "/home/r00t/Music/" "m.mp3"))
>> #"audio/mpeg"
>>
>> does it.
>>
>> Now wondering: How would I go about writing code, such as this- to
>> work on Linux as well as say, a Mac OSX ?
> 
> By checking for the OS and setting the path to the MIME Database
> accordingly. The biggest problem I see would be Windows, which as far
> as I know does not have such a file at all.

I took a cursory look at "mimetypes.py" 
(http://svn.python.org/view/python/trunk/Lib/mimetypes.py?revision=72045&view=markup) 
  - a Python module which acts as a interface with the OS MIME types. 
 From what I see, it has the list of "known files" into which it looks 
into for the OS recogniezed MIME types..

I will try to look into implementing such a solution for plt-scheme..

Best,
Amit
> 
> regards,
> Marek
> 


-- 
email: amitsaha.in at gmail.com
Journal: http://amitksaha.wordpress.com
µ-blog: http://twitter.com/amitsaha
IRC: cornucopic on #scheme, #lisp, #math, #linux


Posted on the users mailing list.