[epiphany/wip/tingping/profile-exec-line] profile-migrator: Fix new exec line in profile migration



commit be3b951e539a72eda27e433cad171106594511ae
Author: Patrick Griffis <pgriffis igalia com>
Date:   Fri Feb 1 09:11:29 2019 -0500

    profile-migrator: Fix new exec line in profile migration
    
    Closes #664

 src/profile-migrator/ephy-profile-migrator.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index 817e656b0..dbeaa03ec 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -1122,13 +1122,10 @@ migrate_profile_directories (void)
       continue;
     }
 
-    g_autoptr(GRegex) re = g_regex_new ("epiphany/app-epiphany-", 0, 0, NULL);
-    g_autofree char *new_exec = g_regex_replace (re, exec, -1, 0, "epiphany-", 0, &error);
-
-    if (error != NULL) {
-      g_warning ("Failed to replace Exec line %s: %s", exec, error->message);
-      g_clear_error (&error);
-    }
+    // Replace the exec line in the desktop file
+    g_autofree char *old_profile_prefix = g_build_filename (legacy_profile_dir (), "app-epiphany-", NULL);
+    g_autofree char *new_profile_prefix = g_build_filename (g_get_user_data_dir (), "epiphany-", NULL);
+    g_autofree char *new_exec = ephy_string_find_and_replace (exec, old_profile_prefix, new_profile_prefix);
 
     LOG ("migrate_profile_directories: setting Exec to %s", new_exec);
     g_key_file_set_string (file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_EXEC, new_exec);


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