On Mon, 30 May 2011 14:48:20 +0200, François Revol wrote:
+1, that's why we use MIME types on files in xattrs and have a
MIME
sniffer in Haiku, just like BeOS did for 15 years. :p
Things are a little more difficult here as there is no OS-wide MIME
support, so I have to detect the file type and then convert it myself
to the equivalent MIME type. I've mostly rewritten it to clean it up,
just need to migrate the old functions/code across to the new scheme.
> I see no
> reason why the data (or at least the first few bytes) couldn't be
> available before you need to work out what type it is.
Sometimes the file is empty :p
In that case, the MIME type is application/unknown or something like
that :)
Of course there are some corner cases like directories (BeOS also
has a mime type for those but different than NS')
I don't think NS uses that any more.
, and usual types
like text/html which the OS might differentiate a bit too much
sometimes or identify differently (text/xml+html for xhtml?).
One of the documents you linked to provides all the test cases for
different (usual) filetypes and suggested not to do any other tests
for these types. Perhaps files should be sniffed by the core using
this citeria and only passed to the platform code if nothing matches?
Chris