[gnome-terminal] Move home dir fallback to terminal_screen_launch_child



commit 08d8540d63ccccaa02c18af832f5329b38bcc1ec
Author: Christian Persch <chpe gnome org>
Date:   Thu Apr 23 12:58:23 2009 +0200

    Move home dir fallback to terminal_screen_launch_child
    
    Don't return the home dir from
    terminal_screen_get_current_dir_with_fallback. Only return the initial
    working dir if priv->pty_fd == -1. Bug ##565328.
---
 src/terminal-screen.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index adc2cb8..a1d3be3 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -1546,6 +1546,7 @@ terminal_screen_launch_child (TerminalScreen *screen)
   char *path, *shell = NULL;
   GError *err = NULL;
   gboolean update_records;
+  const char *working_dir;
 
   profile = priv->profile;
 
@@ -1563,11 +1564,16 @@ terminal_screen_launch_child (TerminalScreen *screen)
 
   update_records = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_UPDATE_RECORDS);
 
+  if (priv->initial_working_directory)
+    working_dir = priv->initial_working_directory;
+  else
+    working_dir = g_get_home_dir ();
+
   priv->child_pid = vte_terminal_fork_command (terminal,
                                                path,
                                                argv,
                                                env,
-                                               priv->initial_working_directory,
+                                               working_dir,
                                                terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_LOGIN_SHELL),
                                                update_records,
                                                update_records);
@@ -1834,16 +1840,11 @@ char*
 terminal_screen_get_current_dir_with_fallback (TerminalScreen *screen)
 {
   TerminalScreenPrivate *priv = screen->priv;
-  char *cwd;
 
-  cwd = terminal_screen_get_current_dir (screen);
-  if (cwd != NULL)
-    return cwd;
-
-  if (priv->initial_working_directory != NULL)
+  if (priv->pty_fd == -1)
     return g_strdup (priv->initial_working_directory);
 
-  return g_strdup (g_get_home_dir ());
+  return terminal_screen_get_current_dir (screen);
 }
 
 void



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