--- update-mime-database.c.orig 2007-02-06 11:34:33.000000000 +0100 +++ update-mime-database.c 2007-04-20 08:18:31.888125000 +0200 @@ -695,8 +695,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 +713,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); @@ -2811,6 +2819,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 +2832,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 +2845,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 +2858,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);