--- update-mime-database.c.orig 2007-02-06 11:34:33.000000000 +0100 +++ update-mime-database.c 2007-04-24 09:11:17.296875000 +0200 @@ -32,6 +32,14 @@ #define MIME_ERROR g_quark_from_static_string("mime-error-quark") +#ifndef PATH_SEPARATOR +# ifdef _WIN32 +# define PATH_SEPARATOR ";" +# else +# define PATH_SEPARATOR ":" +# endif +#endif + /* This is the list of directories to scan when finding old type files to * delete. It is also used to warn about invalid MIME types. */ @@ -695,8 +703,12 @@ new_name = g_strndup(pathname, len - 4); +#ifdef _WIN32 + /* we need to remove the old file first! */ + remove(new_name); +#endif if (rename(pathname, new_name)) - g_warning("Failed to rename %s as %s\n", pathname, new_name); + g_warning("Failed to rename %s as %s , errno: %d\n", pathname, new_name, errno); g_free(new_name); } @@ -709,7 +721,11 @@ char *media, *filename; media = g_strconcat(mime_dir, "/", type->media, NULL); +#ifdef _WIN32 + mkdir(media); +#else mkdir(media, 0755); +#endif filename = g_strconcat(media, "/", type->subtype, ".xml.new", NULL); g_free(media); @@ -1493,8 +1509,8 @@ env = getenv("XDG_DATA_DIRS"); if (!env) - env = "/usr/local/share/:/usr/share/"; - dirs = g_strsplit(env, ":", 0); + env = "/usr/local/share/"PATH_SEPARATOR"/usr/share/"; + dirs = g_strsplit(env, PATH_SEPARATOR, 0); g_return_if_fail(dirs != NULL); for (n = 0; dirs[n]; n++) ; @@ -2811,6 +2827,7 @@ ns_path = g_strconcat(mime_dir, "/XMLnamespaces.new", NULL); stream = open_or_die(ns_path); write_namespaces(stream); + fclose(stream); atomic_update(ns_path); g_free(ns_path); @@ -2823,6 +2840,7 @@ path = g_strconcat(mime_dir, "/subclasses.new", NULL); stream = open_or_die(path); write_subclasses(stream); + fclose(stream); atomic_update(path); g_free(path); @@ -2835,6 +2853,7 @@ path = g_strconcat(mime_dir, "/aliases.new", NULL); stream = open_or_die(path); write_aliases(stream); + fclose(stream); atomic_update(path); g_free(path); @@ -2847,6 +2866,7 @@ path = g_strconcat(mime_dir, "/mime.cache.new", NULL); stream = open_or_die(path); write_cache(stream); + fclose(stream); atomic_update(path); g_free(path);