diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-10-03 19:29:48 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-10-03 19:29:48 +0100 |
commit | c6376c798433bcb9ee38a8664299d11454546950 (patch) | |
tree | 012d7e527e8103d3d28af5d76b0add159e4e2e43 /src/os_unix.c | |
parent | 5a9357d0bff9059f547906d8d03b31bca7215af1 (diff) | |
download | vim-git-c6376c798433bcb9ee38a8664299d11454546950.tar.gz |
patch 8.2.3468: problem with :cd when editing file in non-existent directoryv8.2.3468
Problem: Problem with :cd when editing file in non-existent directory. (Yee
Cheng Chin)
Solution: Prepend the current directory to get the full path. (closes #8903)
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index a3e5430ef..d192b6bcf 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -2647,7 +2647,15 @@ mch_FullName( { vim_strncpy(buf, fname, p - fname); if (mch_chdir((char *)buf)) - retval = FAIL; + { + // Path does not exist (yet). For a full path fail, + // will use the path as-is. For a relative path use + // the current directory and append the file name. + if (mch_isFullName(fname)) + retval = FAIL; + else + p = NULL; + } else if (*p == '/') fname = p + 1; else |