[Xfce4-commits] <midori:master> Handle relative config in Midori.Paths.init

Christian Dywan noreply at xfce.org
Sun Dec 2 16:34:01 CET 2012


Updating branch refs/heads/master
         to aead1a8f0a6302f45c2e2207db52f48336624a87 (commit)
       from 50452fb94f5d970f2176eed27e5447c45bc426f9 (commit)

commit aead1a8f0a6302f45c2e2207db52f48336624a87
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Dec 2 13:29:03 2012 +0100

    Handle relative config in Midori.Paths.init

 katze/midori-paths.vala |   10 +++++++---
 midori/main.c           |   10 ----------
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/katze/midori-paths.vala b/katze/midori-paths.vala
index 511148a..8f51a5d 100644
--- a/katze/midori-paths.vala
+++ b/katze/midori-paths.vala
@@ -66,7 +66,7 @@ namespace Midori {
             return mode;
         }
 
-        public static void init (RuntimeMode new_mode, string? config_base) {
+        public static void init (RuntimeMode new_mode, string? config) {
             assert (mode == RuntimeMode.UNDEFINED);
             assert (new_mode != RuntimeMode.UNDEFINED);
             mode = new_mode;
@@ -83,7 +83,9 @@ namespace Midori {
                     exec_path, "profile", "tmp");
             }
             else if (mode == RuntimeMode.PRIVATE || mode == RuntimeMode.APP) {
-                readonly_dir = config_base ?? Path.build_path (Path.DIR_SEPARATOR_S,
+                string? real_config = config != null && !Path.is_absolute (config)
+                    ? Path.build_filename (Environment.get_current_dir (), config) : config;
+                readonly_dir = real_config ?? Path.build_path (Path.DIR_SEPARATOR_S,
                     Environment.get_user_config_dir (), PACKAGE_NAME);
                 cache_dir_for_reading = Path.build_path (Path.DIR_SEPARATOR_S,
                     Environment.get_user_cache_dir (), PACKAGE_NAME);
@@ -92,7 +94,9 @@ namespace Midori {
                     Environment.get_tmp_dir (), "midori-" + Environment.get_user_name ());
             }
             else {
-                config_dir = config_base ?? Path.build_path (Path.DIR_SEPARATOR_S,
+                string? real_config = config != null && !Path.is_absolute (config)
+                    ? Path.build_filename (Environment.get_current_dir (), config) : config;
+                config_dir = real_config ?? Path.build_path (Path.DIR_SEPARATOR_S,
                     Environment.get_user_config_dir (), PACKAGE_NAME);
                 cache_dir = Path.build_path (Path.DIR_SEPARATOR_S,
                     Environment.get_user_cache_dir (), PACKAGE_NAME);
diff --git a/midori/main.c b/midori/main.c
index 14c508b..2140074 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -353,16 +353,6 @@ main (int    argc,
     error = NULL;
     midori_app_setup (&argc, &argv, entries);
 
-    /* Relative config path */
-    if (config && !g_path_is_absolute (config))
-    {
-        gchar* old_config = config;
-        gchar* current_dir = g_get_current_dir ();
-        config = g_build_filename (current_dir, old_config, NULL);
-        g_free (current_dir);
-        g_free (old_config);
-    }
-
     g_set_application_name (_("Midori"));
     /* Versioned prgname to override menuproxy blacklist */
     g_set_prgname (PACKAGE_NAME "4");


More information about the Xfce4-commits mailing list