From 4d711648263372e06928d1c495efb220c7b804d3 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 10 Jan 2009 19:37:35 +0000 Subject: Pick up cwd from environment,. --- cmd-new-window.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'cmd-new-window.c') diff --git a/cmd-new-window.c b/cmd-new-window.c index f730e3ac..2dad77e8 100644 --- a/cmd-new-window.c +++ b/cmd-new-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-new-window.c,v 1.26 2008-12-10 20:25:41 nicm Exp $ */ +/* $Id: cmd-new-window.c,v 1.27 2009-01-10 19:37:35 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -115,7 +115,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx) struct cmd_new_window_data *data = self->data; struct session *s; struct winlink *wl; - char *cmd; + char *cmd, *cwd; int idx; if (data == NULL) @@ -137,8 +137,12 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx) cmd = data->cmd; if (cmd == NULL) cmd = options_get_string(&s->options, "default-command"); + if (ctx->cmdclient == NULL || ctx->cmdclient->cwd == NULL) + cwd = options_get_string(&global_options, "default-path"); + else + cwd = ctx->cmdclient->cwd; - wl = session_new(s, data->name, cmd, idx); + wl = session_new(s, data->name, cmd, cwd, idx); if (wl == NULL) { ctx->error(ctx, "command failed: %s", cmd); return; -- cgit