From 47589f1c26548b78e38b3283c9480810a0eff855 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 16 Nov 2010 20:51:33 +0000 Subject: [PATCH] Before launching a new terminal window change the current working directory to that of the active tab. This makes the new terminal inherit it. Implements the missing part of #6712. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39458 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/terminal/TermWindow.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp index 39f31a3f48..c3e3deebbc 100644 --- a/src/apps/terminal/TermWindow.cpp +++ b/src/apps/terminal/TermWindow.cpp @@ -477,6 +477,15 @@ TermWindow::MessageReceived(BMessage *message) case MENU_NEW_TERM: { + // Set our current working directory to that of the active tab, so + // that the new terminal and its shell inherit it. + // Note: That's a bit lame. We should rather fork() and change the + // CWD in the child, but since ATM there aren't any side effects of + // changing our CWD, we save ourselves the trouble. + ActiveProcessInfo activeProcessInfo; + if (_ActiveTermView()->GetActiveProcessInfo(activeProcessInfo)) + chdir(activeProcessInfo.CurrentDirectory()); + app_info info; be_app->GetAppInfo(&info);