diff options
author | Xan Lopez <xan@igalia.com> | 2012-05-09 00:35:45 +0800 |
---|---|---|
committer | Xan Lopez <xan@igalia.com> | 2012-05-09 00:35:45 +0800 |
commit | 38fd1803464eb2e4b84298fe323fac47f4af9ab0 (patch) | |
tree | 698a3a360a452b6936fa947a7a7eab40d2a0ff15 | |
parent | 871693a8ea637bb8b5ed4d77fbb7698264a3876e (diff) | |
download | gsoc2013-epiphany-38fd1803464eb2e4b84298fe323fac47f4af9ab0.tar.gz gsoc2013-epiphany-38fd1803464eb2e4b84298fe323fac47f4af9ab0.tar.zst gsoc2013-epiphany-38fd1803464eb2e4b84298fe323fac47f4af9ab0.zip |
ephy-profile-migrator: better safe than sorry in history migration
Do nothing if the destination history file already exists.
-rw-r--r-- | lib/ephy-profile-migrator.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/ephy-profile-migrator.c b/lib/ephy-profile-migrator.c index 055878623..ac5e1846a 100644 --- a/lib/ephy-profile-migrator.c +++ b/lib/ephy-profile-migrator.c @@ -536,16 +536,6 @@ static GMarkupParser history_parse_funcs = NULL, }; -static EphyHistoryService * -ensure_empty_history (const char* filename) -{ - if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) { - g_unlink (filename); - } - - return ephy_history_service_new (filename); -} - static void migrate_history () { @@ -558,7 +548,15 @@ migrate_history () HistoryParseData parse_data; gchar *temporary_file = g_build_filename (ephy_dot_dir (), "ephy-history.db", NULL); - history_service = ensure_empty_history (temporary_file); + /* Do nothing if the history file already exists. Safer than wiping + * it out. */ + if (g_file_test (temporary_file, G_FILE_TEST_EXISTS)) { + g_warning ("Did not migrate Epiphany's history, the ephy-history.db file already exists"); + g_free (temporary_file); + return; + } + + history_service = ephy_history_service_new (temporary_file); g_free (temporary_file); memset (&parse_data, 0, sizeof (HistoryParseData)); |