diff options
author | Bastien Nocera <hadess@hadess.net> | 2014-03-31 16:22:33 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2014-03-31 16:24:23 +0200 |
commit | 3805d0bcf22b6344fb4a4a36ad4e15e30d17b624 (patch) | |
tree | ca6f765e19f4d32dd83b9665aa52b5a994a2b0e0 | |
parent | acb7222ada2ad165a84d0bd33f2af1a93b43d3a8 (diff) | |
download | shared-mime-info-3805d0bcf22b6344fb4a4a36ad4e15e30d17b624.tar.gz |
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
-rw-r--r-- | update-mime-database.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/update-mime-database.c b/update-mime-database.c index 90c915be..c043606a 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; |