Author: bonefish Date: 2010-11-16 21:51:33 +0100 (Tue, 16 Nov 2010) New Revision: 39458 Changeset: http://dev.haiku-os.org/changeset/39458 Ticket: http://dev.haiku-os.org/ticket/6712 Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp Log: 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. Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2010-11-16 20:40:26 UTC (rev 39457) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2010-11-16 20:51:33 UTC (rev 39458) @@ -477,6 +477,15 @@ 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);