Hello, One thing that is missing in shared-mime-database is a way to determine the version of it, at runtime, to handle backwards compatibility. I currently use `update-mime-database -v` but that's a bit inconvenient and slow.
It should be easier to find the version of the database; how about generating a version file along with the other generated files? Patch attached, works nicely. Can I push it? -- David Faure, [email protected], http://www.davidfaure.fr Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).
From 443db0b809c8a75ab4e4b1685c5f64c8fb4b6ea1 Mon Sep 17 00:00:00 2001 From: David Faure <[email protected]> Date: Fri, 4 Feb 2011 11:58:58 +0100 Subject: [PATCH] Generate version file --- update-mime-database.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/update-mime-database.c b/update-mime-database.c index 5175519..3fea6df 100644 --- a/update-mime-database.c +++ b/update-mime-database.c @@ -3705,6 +3705,20 @@ int main(int argc, char **argv) g_free(path); } + { + FILE *stream; + char *path; + + path = g_strconcat(mime_dir, "/version.new", NULL); + stream = open_or_die(path); + g_fprintf(stream, + VERSION "\n"); + fclose(stream); + + atomic_update(path); + g_free(path); + } + g_ptr_array_foreach(magic_array, (GFunc)magic_free, NULL); g_ptr_array_free(magic_array, TRUE); g_ptr_array_foreach(tree_magic_array, (GFunc)tree_magic_free, NULL); -- 1.7.1
_______________________________________________ xdg mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/xdg
