From ccc91e5fdf36668a488350dc2fc508987c2ff73c Mon Sep 17 00:00:00 2001 From: Michael Zuercher Date: Tue, 23 Apr 2002 21:24:18 +0000 Subject: [PATCH] Make konsole restore cwd when restoring session. Only works on linux at this point. svn path=/trunk/kdebase/konsole/; revision=151535 --- configure.in.in | 12 ++++++++++++ konsole/session.cpp | 10 ++++++++++ konsole/session.h | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/configure.in.in b/configure.in.in index bc96c82ca..b52367591 100644 --- a/configure.in.in +++ b/configure.in.in @@ -23,3 +23,15 @@ if test "$ac_use_openpty" = "yes"; then else AC_MSG_RESULT(no) fi + +dnl Set preprocessor variable of how to get cwd from a process +AC_MSG_CHECKING(how cwd can be be found by seperate process) +case "$host" in + *-*-linux*) cwd_method='proc' ;; + *) cwd_method='no' ;; +esac +AC_MSG_RESULT($cwd_method) + +case "$cwd_method" in + proc) AC_DEFINE(HAVE_PROC_CWD, 1, [Defines whether /proc/`pid`/cwd exists]) ;; +esac diff --git a/konsole/session.cpp b/konsole/session.cpp index d1ff5b2cd..c7b031451 100644 --- a/konsole/session.cpp +++ b/konsole/session.cpp @@ -317,6 +317,16 @@ QString TESession::getPgm() return pgm; } +QString TESession::getCwd() +{ +#ifdef HAVE_PROC_CWD + QFileInfo Cwd(QString("/proc/%1/cwd").arg(sh->pid())); + if(Cwd.isSymLink()) + cwd = Cwd.readLink(); +#endif /* HAVE_PROC_CWD */ + return cwd; +} + bool TESession::isMonitorActivity() { return monitorActivity; } bool TESession::isMonitorSilence() { return monitorSilence; } bool TESession::isMasterMode() { return masterMode; } diff --git a/konsole/session.h b/konsole/session.h index 5bfb89c76..96231e0d0 100644 --- a/konsole/session.h +++ b/konsole/session.h @@ -54,7 +54,7 @@ public: QString keymap(); QStrList getArgs(); QString getPgm(); - QString getCwd() { return cwd; } + QString getCwd(); QString getInitial_cwd() { return initial_cwd; } void setHistory(const HistoryType&);