[epiphany] ephy-profile-migrator: do nothing if there's no profile dir



commit db0ec5890ede6b6eefced0b181b3996077d76f3c
Author: Xan Lopez <xan igalia com>
Date:   Wed Aug 29 16:16:51 2012 +0200

    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 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/lib/ephy-profile-migrator.c b/lib/ephy-profile-migrator.c
index 4919896..f013473 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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]