diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c index ebb1032..28cd7f5 100644 --- a/thunar/thunar-file.c +++ b/thunar/thunar-file.c @@ -989,7 +989,7 @@ thunar_file_execute (ThunarFile *file, gchar *escaped_location; gchar **argv = NULL; gchar *exec; - gchar *directory; + gchar *directory = NULL; _thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE); _thunar_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); @@ -1029,6 +1029,8 @@ thunar_file_execute (ThunarFile *file, snotify = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY, NULL); + directory = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, + G_KEY_FILE_DESKTOP_KEY_PATH, NULL); result = thunar_exec_parse (exec, file_list, icon, name, location, terminal, NULL, &argv, error); @@ -1089,7 +1091,10 @@ thunar_file_execute (ThunarFile *file, if (G_LIKELY (result)) { /* determine the working directory */ - if (G_LIKELY (working_directory != NULL)) + if (directory) { + /* provided by the Path field */ + } + else if (G_LIKELY (working_directory != NULL)) { /* copy the working directory provided to this method */ directory = g_file_get_path (working_directory); @@ -1112,14 +1117,12 @@ thunar_file_execute (ThunarFile *file, /* execute the command */ result = xfce_spawn_on_screen (screen, directory, argv, NULL, G_SPAWN_SEARCH_PATH, snotify, gtk_get_current_event_time (), icon, error); - - /* release the working directory */ - g_free (directory); } /* clean up */ g_strfreev (argv); g_free (location); + g_free (directory); return result; }