[1/2] winemenubuilder: associate .lnk files with wine
Damjan Jovanovic
damjan.jov at gmail.com
Tue May 18 14:33:03 CDT 2010
Changelog:
* associate .lnk files with wine
On Ubuntu 10.04, .lnk files no longer gets assigned any MIME type by
default, and winemenubuilder assigns it an ugly
application/x-wine-extension-lnk. Assign it something more commonly
used, and something we can rely on to associate with wine.desktop so
double-clicks on .lnk files work.
Damjan Jovanovic
-------------- next part --------------
diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c
index 4dc08d5..9f10fdb 100644
--- a/programs/winemenubuilder/winemenubuilder.c
+++ b/programs/winemenubuilder/winemenubuilder.c
@@ -1994,6 +1994,14 @@ static BOOL is_extension_blacklisted(LPCWSTR extension)
return FALSE;
}
+static const char* get_special_mime_type(LPCWSTR extension)
+{
+ static const WCHAR lnkW[] = {'.','l','n','k',0};
+ if (!strcmpiW(extension, lnkW))
+ return "application/x-ms-shortcut";
+ return NULL;
+}
+
static BOOL write_freedesktop_association_entry(const char *desktopPath, const char *dot_extension,
const char *friendlyAppName, const char *mimeType,
const char *progId)
@@ -2102,6 +2110,8 @@ static BOOL generate_associations(const char *xdg_data_home, const char *package
{
if (contentTypeW != NULL && strchrW(contentTypeW, '/'))
mimeTypeA = wchars_to_utf8_chars(contentTypeW);
+ else if ((get_special_mime_type(extensionW)))
+ mimeTypeA = strdupA(get_special_mime_type(extensionW));
else
mimeTypeA = heap_printf("application/x-wine-extension-%s", &extensionA[1]);
More information about the wine-patches
mailing list