From 3805d0bcf22b6344fb4a4a36ad4e15e30d17b624 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 31 Mar 2014 16:22:33 +0200 Subject: [PATCH] Store MEDIA/SUBTYPE.xml files in lowercase RFC 2045 says that MIME type names (e.g. text/plain) are case-insensitive. Most are written by convention in lowercase, although there are a few exceptions currently in the freedesktop.org.xml database. Store the separate mime files as lower-case to make them easily findable (eg. the synonymous application/vnd.*macroEnabled* and *macroenabled* mime-type should have the same filename). https://bugs.freedesktop.org/show_bug.cgi?id=62473 --- update-mime-database.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/update-mime-database.c b/update-mime-database.c index 90c915b..c043606 100644 --- a/update-mime-database.c +++ b/update-mime-database.c @@ -995,15 +995,20 @@ static void write_out_type(gpointer key, gpointer value, gpointer data) const char *mime_dir = (char *) data; char *media, *filename; GError *local_error = NULL; + char *lower; - media = g_strconcat(mime_dir, "/", type->media, NULL); + lower = g_ascii_strdown(type->media, -1); + media = g_strconcat(mime_dir, "/", lower, NULL); + g_free(lower); #ifdef _WIN32 mkdir(media); #else mkdir(media, 0755); #endif - filename = g_strconcat(media, "/", type->subtype, ".xml.new", NULL); + lower = g_ascii_strdown(type->subtype, -1); + filename = g_strconcat(media, "/", lower, ".xml.new", NULL); + g_free(lower); g_free(media); media = NULL; -- 1.9.0