xdgmime detection question
dbera.web at gmail.com
Wed Feb 14 06:28:46 PST 2007
I am using xdgmime to detect mimetypes. I simply call
xdg_mime_get_mime_type_for_file(path) and have HAVE_MMAP defined to
make use of the cache. For testing I simply use the test-mime.c
included in the repository.
I have two questions:
1) The spec defines something called Override.xml where I (as a user),
can add overrides on how existing mimetypes are handles. I does not
seem to have any effect. For example, I changed the jpeg mimetype
detection to only include magic and remove the glob, also I increased
the magic priority to 90; ran update-mime-database. Checked the local
cache file, it seemed to contain the new rules. But nothing changed as
far as jpeg detection was concerned. This was just an example, nothing
happens for other similar cases too.
2) The spec says something like first using magic with priority over
80, then using glob, then using other magic. But the implementation,
always seem to prefer extension over magic. In practice for example,
if I take a pdf file, rename it to foo.gif and then run test-mime on
it, it is detected as gif!
It is extremely important that I get accurate mimetype detection, as
much as possible. Opening the files everytime to read the magic is not
an issue with me. Is there any thing I should define or any other API
call to get xdgmime to give me the correct mimetype ?
Debajyoti Bera @ http://dtecht.blogspot.com
beagle / KDE fan
Mandriva / Inspiron-1100 user
More information about the xdg