Created attachment 40278 [details] [review] search mimeinfo.cache too xdg-mime searches only defaults.list for an application to support given mime type. The patch makes it grep mimeinfo.cache too.
Why is this needed? Isn't the cache based from defaults.list? (and are we assured the internals of the .cache will remain consistent?)
As far as I can tell: no. These seems to be completely independent and to too well "specified" files. The mimeinfo.cache *was* mentioned by the Desktop Entry Specification (but only until version 0.9.4) and is used by software (I find Thunar using it on my system for example). I can find only some discussions on defaults.list on freedesktop mailing lists. BTW. the mimeinfo.cache I am talking about is a text file with a similar format as defaults.list and not some binary blob like the /usr/share/mime/mime.cache.
First of all, I think this patch does the right thing -- but mimeapps.list also needs to be checked. There seems to be some confusion, so I'll add some explanations. mimeinfo.cache (both the system one and the user's one) are ENUMERATIONS of AVAILABLE handlers for each mime type. They encode no preference or PRIORITY. User preference is encoded in defaults.list and mimeapps.list. defaults.list is older, gnome-specific, and no longer freedesktop-supported. mimeapps.list is newer, freedesktop-approved, and KDE-supported. The "lighter" desktop environments (XFCE, LXDE) seem to still use defaults.list. What happens when a user selects an "unusual" association? In LXDE, if I set "Open With" for text files to xpdf, 1) a new ~/.local/share/applications/xpdf-usercustom-0.desktop is created 2) ~/.local/share/applications/mimeinfo.cache and defaults.list are updated, associating text/plain to the new desktop file Bottom line: look in defaults.list and/or mimeapps.list first, to pick the user's preferred app; then in mimeinfo.cache, to pick any available handler.
patch committed, thanks. http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=050333e34e2fe7430ad2ead37e5a0420ac0c2a3e
It should do the same with the user's directories. update-desktop-database regenerates ~/.local/share/applications/mimeinfo.cache and it's not being searched as of 1.1.0 rc3.
Created attachment 115022 [details] [review] xdg-mime patch to lookup mimeinfo.cache in the user dir Here's the patch so mimeinfo.cache of the user is used as well.
Thanks! http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=c55122295c2a480fa721a9614f0e2d42b2949c18
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.