aboutsummaryrefslogtreecommitdiff
path: root/cmd.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2011-12-30 14:21:02 +0000
committerTiago Cunha <tcunha@gmx.com>2011-12-30 14:21:02 +0000
commite2d59a6c1713cdb18f0a96ad9da9eac11fa60d88 (patch)
tree1f4fa46f9466ed1209228f9a1a0fa1f2e6f1cc90 /cmd.c
parent2ca18493501ce0e7709503d89a54394718580b19 (diff)
downloadrtmux-e2d59a6c1713cdb18f0a96ad9da9eac11fa60d88.tar.gz
rtmux-e2d59a6c1713cdb18f0a96ad9da9eac11fa60d88.tar.bz2
rtmux-e2d59a6c1713cdb18f0a96ad9da9eac11fa60d88.zip
Sync OpenBSD patchset 993:
Allow $HOME as default-path in tmux.conf so the same config file can be used on different machines regardless of where the user's home directory is. ok nicm
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmd.c b/cmd.c
index aee095e6..85ae1dd2 100644
--- a/cmd.c
+++ b/cmd.c
@@ -1220,11 +1220,18 @@ cmd_get_default_path(struct cmd_ctx *ctx)
char *cwd;
struct session *s;
struct window_pane *wp;
+ struct environ_entry *envent;
if ((s = cmd_current_session(ctx, 0)) == NULL)
return (NULL);
cwd = options_get_string(&s->options, "default-path");
+ if ((cwd[0] == '~' && cwd[1] == '\0') || !strcmp(cwd, "$HOME")) {
+ envent = environ_find(&global_environ, "HOME");
+ if (envent != NULL && *envent->value != '\0')
+ return envent->value;
+ cwd = "";
+ }
if (*cwd == '\0') {
if (ctx->cmdclient != NULL && ctx->cmdclient->cwd != NULL)
return (ctx->cmdclient->cwd);