[gnome-terminal] client: Get the current directory via PWD
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] client: Get the current directory via PWD
- Date: Mon, 4 Jun 2012 20:52:50 +0000 (UTC)
commit b45b1f8be2c44d41a18186e0b5859c32bc00c1c2
Author: Christian Persch <chpe gnome org>
Date: Mon Jun 4 21:04:45 2012 +0200
client: Get the current directory via PWD
If PWD is set and refers to the current directory, use PWD. This is necessary
so that when opening a new terminal in a directory that is a symlink, the shell
starts in the symlink'd directory and not in the symlink's target.
https://bugzilla.gnome.org/show_bug.cgi?id=502146
src/terminal.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/terminal.c b/src/terminal.c
index ffb7c8e..7075d15 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -19,7 +19,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <config.h>
+#include "config.h"
+#define _GNU_SOURCE
#include <errno.h>
#include <locale.h>
@@ -193,7 +194,7 @@ int
main (int argc, char **argv)
{
int i;
- char **argv_copy;
+ char **argv_copy, *cwd;
const char *startup_id, *display_name;
GdkDisplay *display;
TerminalOptions *options;
@@ -219,7 +220,14 @@ main (int argc, char **argv)
argv_copy [i] = NULL;
startup_id = g_getenv ("DESKTOP_STARTUP_ID");
- working_directory = g_get_current_dir ();
+
+ /* We use get_current_dir_name() here instead of getcwd / g_get_current_dir()
+ * because we want to use the value from PWD (if it is correct).
+ * See bug 502146.
+ */
+ cwd = get_current_dir_name ();
+ working_directory = g_strdup (cwd);
+ free (cwd);
options = terminal_options_parse (working_directory,
startup_id,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]