summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@igalia.com>2019-05-24 13:47:00 -0500
committerMichael Catanzaro <mcatanzaro@igalia.com>2019-06-11 17:28:03 -0500
commit220f07f1bb97f21a8de48ed0b526b3a05b3779ab (patch)
tree30f5fd4962b4dd9c815c3a53ff5f82415c038c42
parent892306c3afa8971110599210d4af9027465adb36 (diff)
downloadepiphany-220f07f1bb97f21a8de48ed0b526b3a05b3779ab.tar.gz
profile-migrator: fix profile dir migration for web app mode
If we launch a web app before launching the main browser instance, we try to migrate relative to the wrong directory. Oops. We'll need to rerun the migration to fix this for users who already have broken migrations. Fixes #713, albeit imperfectly.
-rw-r--r--src/profile-migrator/ephy-profile-migrator.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index a68ba65a1..b866e7f6d 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -57,8 +57,9 @@ static int do_step_n = -1;
static int migration_version = -1;
static char *profile_dir = NULL;
-/* The legacy dir is used by everything before version 29 which migrates
- * to the new directory */
+/* The legacy dir is used by everything before version 30, which migrates
+ * to the new directory.
+ */
static const char *
legacy_default_profile_dir (void)
{
@@ -74,11 +75,14 @@ legacy_profile_dir (void)
static char *dir = NULL;
if (dir == NULL)
{
- /* If this isn't actually a legacy dir it starts at a later migrating step anyway */
if (profile_dir != NULL)
- dir = profile_dir;
+ {
+ dir = profile_dir;
+ }
else
- dir = (char *)legacy_default_profile_dir ();
+ {
+ dir = (char *)legacy_default_profile_dir ();
+ }
}
return dir;
}
@@ -1067,7 +1071,7 @@ migrate_profile_directories (void)
g_autoptr(GError) error = NULL;
g_autofree char *old_name = g_strconcat ("app-epiphany-", app->id, NULL);
- g_autofree char *old_path = g_build_filename (legacy_profile_dir (), old_name, NULL);
+ g_autofree char *old_path = g_build_filename (legacy_default_profile_dir (), old_name, NULL);
g_autofree char *app_path = ephy_web_application_get_profile_directory (app->id);
if (!move_directory_contents (old_path, app_path))
@@ -1082,7 +1086,7 @@ migrate_profile_directories (void)
close (fd);
// Update Exec and Icon to point to the new profile dir
- g_autofree char *old_profile_prefix = g_build_filename (legacy_profile_dir (), "app-epiphany-", NULL);
+ g_autofree char *old_profile_prefix = g_build_filename (legacy_default_profile_dir (), "app-epiphany-", NULL);
g_autofree char *new_profile_prefix = g_build_filename (g_get_user_data_dir (), "epiphany-", NULL);
g_autoptr(GKeyFile) file = g_key_file_new ();
g_autofree char *desktop_file_path = g_build_filename (app_path, app->desktop_file, NULL);