summaryrefslogtreecommitdiffstats
path: root/src/filepath.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-11-18 20:47:31 +0000
committerBram Moolenaar <Bram@vim.org>2021-11-18 20:47:31 +0000
commit851c7a699ae00bdc14a4db874cf722b7b7393b53 (patch)
tree28e2e265f8a6d37e892e6e8123032355eb9da331 /src/filepath.c
parent0526815c15170a5926e1008600ec29d42d8b64c2 (diff)
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is usedv8.2.3618
Problem: getcwd() is unclear about how 'autochdir' is used. Solution: Update the help for getcwd(). Without any arguments always return the actual current directory. (closes #9142)
Diffstat (limited to 'src/filepath.c')
-rw-r--r--src/filepath.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/filepath.c b/src/filepath.c
index 74ee2ec15a..f4bddf859c 100644
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -1102,13 +1102,15 @@ f_getcwd(typval_T *argvars, typval_T *rettv)
else
wp = find_tabwin(&argvars[0], &argvars[1], &tp);
- if (wp != NULL && wp->w_localdir != NULL)
+ if (wp != NULL && wp->w_localdir != NULL
+ && argvars[0].v_type != VAR_UNKNOWN)
rettv->vval.v_string = vim_strsave(wp->w_localdir);
- else if (tp != NULL && tp->tp_localdir != NULL)
+ else if (tp != NULL && tp->tp_localdir != NULL
+ && argvars[0].v_type != VAR_UNKNOWN)
rettv->vval.v_string = vim_strsave(tp->tp_localdir);
else if (wp != NULL || tp != NULL || global)
{
- if (globaldir != NULL)
+ if (globaldir != NULL && argvars[0].v_type != VAR_UNKNOWN)
rettv->vval.v_string = vim_strsave(globaldir);
else
{