From af52bd9179d34a6273e8279fb23ed50eea9c42b8 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Wed, 29 Aug 2012 16:16:12 +0200 Subject: ephy-file-helpers: add '.migrated' file to newly created profile dirs Otherwise we'll try to migrate old data in new ephy installs, which does not make sense. --- lib/ephy-file-helpers.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'lib/ephy-file-helpers.c') diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c index 4975811f8..9ccdf017b 100644 --- a/lib/ephy-file-helpers.c +++ b/lib/ephy-file-helpers.c @@ -26,6 +26,7 @@ #include "ephy-prefs.h" #include "ephy-debug.h" +#include "ephy-profile-utils.h" #include "ephy-settings.h" #include "ephy-string.h" @@ -429,18 +430,30 @@ ephy_ensure_dir_exists (const char *dir, 0, _("The file “%s” exists. Please move it out of the way."), dir); + return FALSE; } - if (!g_file_test (dir, G_FILE_TEST_EXISTS) && - g_mkdir_with_parents (dir, 488) != 0) + if (!g_file_test (dir, G_FILE_TEST_EXISTS)) { - g_set_error (error, - EPHY_FILE_HELPERS_ERROR_QUARK, - 0, - _("Failed to create directory “%s”."), - dir); - return FALSE; + if (g_mkdir_with_parents (dir, 488) == 0) + { + /* We need to set the .migrated file to the + * current profile migration version, + * otherwise the next time the browser runs + * things might go awry. */ + ephy_profile_utils_set_migration_version (EPHY_PROFILE_MIGRATION_VERSION); + } + else + { + g_set_error (error, + EPHY_FILE_HELPERS_ERROR_QUARK, + 0, + _("Failed to create directory “%s”."), + dir); + + return FALSE; + } } return TRUE; -- cgit