Way to determine content-type of a file?

BlitzMax Forums/BlitzMax Programming/Way to determine content-type of a file?

Htbaa(Posted 2009) [#1]
I've used the search function but can't find anything about it. Is there native support in BlitzMax, or maybe through a module, to get the content-type of a file? One that does a decent check, not on extension.

Thanks.


Brucey(Posted 2009) [#2]
By parsing the file you mean, or by file-extension, or ?

Given the plethora of file formats, either you'd be specifically looking at a minimal set of these you are interested in, or would have access to some mega-library ;-)

Image formats for example, one might look to FreeImage, which has some detection functionality built in.


Htbaa(Posted 2009) [#3]
No not by file extension :P. Although I could come pretty far with it though, at least for my purposes.

I've been looking for an 3rd party library but can't really find anything. I must be looking in the wrong direction I think.


Brucey(Posted 2009) [#4]
This is an Apache licensed Java library for detecting mime types. You could always port it to BlitzMax. Or perhaps there's something similar in C/C++ ?

:-)


Htbaa(Posted 2009) [#5]
Hmm in that case I think I'll fix up something with using the file-extension.