[Xfce4-commits] <midori:master> Check if path is absolute before building exec_path

Christian Dywan noreply at xfce.org
Fri Aug 3 21:08:01 CEST 2012


Updating branch refs/heads/master
         to bf026bd905cf32a5aba3263706f33cf1927647df (commit)
       from acd6ef7eac74bd716b753372e1cde7cf6fa5951b (commit)

commit bf026bd905cf32a5aba3263706f33cf1927647df
Author: Paweł Forysiuk <tuxator at o2.pl>
Date:   Tue Jul 31 19:09:59 2012 +0200

    Check if path is absolute before building exec_path

 midori/midori-app.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/midori/midori-app.c b/midori/midori-app.c
index 1822a91..f27562c 100644
--- a/midori/midori-app.c
+++ b/midori/midori-app.c
@@ -1509,9 +1509,22 @@ midori_app_setup (gchar** argument_vector)
     #ifdef G_OS_WIN32
     exec_path = g_win32_get_package_installation_directory_of_module (NULL);
     #else
-    executable = g_file_read_link (command_line[0], NULL);
+    if (!g_path_is_absolute (command_line[0]))
+    {
+        gchar* program = g_find_program_in_path (command_line[0]);
+
+        if (g_file_test (program, G_FILE_TEST_IS_SYMLINK))
+            executable = g_file_read_link (program, NULL);
+        else
+            executable = g_strdup (program);
+
+        g_free (program);
+    }
+    else
+        executable = g_file_read_link (command_line[0], NULL);
+
     exec_path = g_file_get_path (g_file_get_parent (g_file_get_parent (g_file_new_for_path (
-        g_find_program_in_path (executable ? executable : command_line[0])))));
+        executable ? executable : command_line[0]))));
     g_free (executable);
     #endif
 


More information about the Xfce4-commits mailing list