[epiphany/mcatanzaro/webapp-profile: 7/23] profile-migrator: Migrate main profile directory only once



commit f49e61df64ab6b9d8e4ffc02562bb34f15bbd711
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sat Mar 16 11:13:03 2019 -0500

    profile-migrator: Migrate main profile directory only once
    
    Trying to migrate the default profile directory multiple times is bad.
    Migrate it only if the migrator is being run for the default profile.

 src/profile-migrator/ephy-profile-migrator.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index 2eca302c1..5778e2b2d 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -1057,7 +1057,10 @@ migrate_profile_directories (void)
 {
   GList *web_apps, *l;
 
-  /* Web app profiles moved from config to data dirs */
+  /* Web app profiles moved from config to data dirs. If this migration has
+   * already been run for a separate profile, then then legacy application list
+   * should be empty, so it's harmless to run this multiple times.
+   */
   web_apps = ephy_web_application_get_legacy_application_list ();
   for (l = web_apps; l; l = l->next) {
     EphyWebApplication *app = (EphyWebApplication *)l->data;
@@ -1129,7 +1132,12 @@ migrate_profile_directories (void)
 
   ephy_web_application_free_application_list (web_apps);
 
-  /* The default profile also changed directories */
+  /* The default profile also changed directories. This needs to run only once,
+   * for the main browser instance.
+   */
+  if (!ephy_profile_dir_is_default ())
+    return;
+
   g_autoptr(GFile) old_directory = g_file_new_for_path (legacy_default_profile_dir ());
   g_autoptr(GFile) new_directory = g_file_new_for_path (ephy_default_profile_dir ());
 


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