[Portland-bugs] [Bug 30449] xdg-mime ought to use shared-mime-info

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Jan 28 17:09:42 PST 2011


https://bugs.freedesktop.org/show_bug.cgi?id=30449

--- Comment #7 from splondike at yahoo.com 2011-01-28 17:09:42 PST ---
Created an attachment (id=42680)
 --> (https://bugs.freedesktop.org/attachment.cgi?id=42680)
A (partial) shared-mime-info using mimetype checker

Hi, I'm the guy who wrote the email referenced in comment #5. I've finally got
around to continuing where I left off, and this is my take on the situation.

I wrote a partial implementation of shared-mime-info's recommended mime type
checking algorithm
(http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.18.html#id2554407)
purely using standard shell utilities. My current implementation is attached,
it doesn't yet use the subclasses file or the mask and byte swap options in the
magic file.

While doing the glob and subclasses checking was/would be pretty easy, using
the magic file (i.e. checking for binary matches) was a bit of a square
peg/round hole situation.

I would suggest adding a patch similar to the one mentioned in comment #6 by
Per, keeping info_generic as a fallback and not worrying about my solution. I
think using File:MimeInfo would be acceptable to alternate DE users like me.
The only situation where it wouldn't be I think is where Perl would not
otherwise be installed.

Another solution would be to write a small-ish C program to implement the mime
type checking. shared-mime-info has a mmappable file called mime.cache for this
purpose.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Portland-bugs mailing list