[epiphany/mcatanzaro/web-apps-again-again-again: 6/9] profile-migrator: fail migration if current profile dir is moved



commit 917140c419d276e3dbfda8f8d0b8d2da818a0165
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Fri May 24 15:32:18 2019 -0500

    profile-migrator: fail migration if current profile dir is moved
    
    This is for web apps only, and only if they are migrated before the
    default profile. The first attempt to run the web app after migration
    will fail, and it will need to be started a second time in order to pick
    up the new profile dir in the modified desktop file. This is pretty
    unfortunate, but difficult to avoid.

 src/profile-migrator/ephy-profile-migrator.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index 63d57eee3..b6d8ca579 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -1419,6 +1419,15 @@ ephy_migrator (void)
     m ();
   }
 
+  if (!g_file_test (ephy_profile_dir (), G_FILE_TEST_EXISTS)) {
+    LOG ("Original profile directory does not exist. This is an expected"
+         " failure. Probably a web app is being migrated before the default"
+         " profile, and its profile directory was moved during the migration."
+         " Epiphany must be restarted with the new profile directory. The"
+         " migration will be run again.");
+    return FALSE;
+  }
+
   if (ephy_profile_utils_set_migration_version (EPHY_PROFILE_MIGRATION_VERSION) != TRUE) {
     LOG ("Failed to store the current migration version");
     return FALSE;


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