[epiphany] ephy-file-helpers: add '.migrated' file to newly created profile dirs



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

    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 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index 4975811..9ccdf01 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;



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