From db0ec5890ede6b6eefced0b181b3996077d76f3c Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Wed, 29 Aug 2012 16:16:51 +0200 Subject: ephy-profile-migrator: do nothing if there's no profile dir If there's no profile dir there should not be anything to do for the profile migrator (since in theory epiphany has never been executed). This might backfire for people that manually mess with their profile dir (removing it), but those people hopefully know what they are doing. --- lib/ephy-profile-migrator.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/ephy-profile-migrator.c b/lib/ephy-profile-migrator.c index 4919896e3..f013473c0 100644 --- a/lib/ephy-profile-migrator.c +++ b/lib/ephy-profile-migrator.c @@ -60,6 +60,12 @@ static int do_step_n = -1; typedef void (*EphyProfileMigrator) (void); +static gboolean +profile_dir_exists () +{ + return g_file_test (ephy_dot_dir (), G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR); +} + static void migrate_cookies () { @@ -787,6 +793,12 @@ ephy_migrator () * very beginning. */ migrate_profile_gnome2_to_xdg (); + /* If after this point there's no profile dir, there's no point in + * running anything because Epiphany has never run in this sytem, so + * exit here. */ + if (!profile_dir_exists ()) + return TRUE; + if (do_step_n != -1) { if (do_step_n >= EPHY_PROFILE_MIGRATION_VERSION) return FALSE; -- cgit v1.2.3