http://bugs.winehq.org/show_bug.cgi?id=28160
Summary: [integration] winemenubuilder should have a consistent way to deal with extensions that have multiple (native) mimetypes Product: Wine Version: 1.3.26 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: programs AssignedTo: wine-bugs@winehq.org ReportedBy: wine@rodrigosilva.com
Granted, extensions (globs) and mimetypes do not have a 1-1 mapping. and things like aliases, parents, and user/system databases only make this mapping harder. Even if a perfect match is not possible, there is room to improve winemenubuilder. Currently, when it tries to match a given extension with a native mamitype, it concatenates user and system globs and... thats it. Picks the 1st match it finds. No sorting. No removing duplicates.
That makes winemenubuilder really unpredictable. For instance, in my native system i currently have this:
asc application/pgp-encrypted asc application/pgp-keys asc text/plain
ogg audio/ogg ogg audio/x-flac+ogg ogg audio/x-speex+ogg ogg audio/x-vorbis+ogg ogg video/x-theora+ogg
sub text/x-microdvd sub text/x-mpsub sub text/x-subviewer
So, if winemenubuilder finds HKCR.ogg , which of the 5 will it pick? The 1st one it finds... which is? Who knows! It doesnt look at ContentType value before assuming the "one and only" mimetype for that ext is the one he picked from fd.o mime database.
That makes impossible for a script to "pre-build" a HKCU\Software\Wine\FileOpenAssociations*ogg entry to inhibit winemenubuilder from creating a redundant native association (x-wine-extension-ogg.desktop file and others)
My suggestion, 2 different approaches to solve this:
1 - If [HKCR.ext]ContentType=xxx is found, respect it. That means generate_associations() should read ContentType *before* calling freedesktop_mime_type_for_extension() , not *instead* of it.
2 - change build_native_mime_types() algorithm to *sort* the entries when building mime_types list, either sort(user)+sort(system) or sort(user+system). That way freedesktop_mime_type_for_extension()'s pick will be an easily predictable one.
This bug is closely related to http://bugs.winehq.org/show_bug.cgi?id=28158 and http://bugs.winehq.org/show_bug.cgi?id=28159