Mercurial > vim
diff src/os_unix.c @ 25868:bcf55847d2ed v8.2.3468
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Commit: https://github.com/vim/vim/commit/c6376c798433bcb9ee38a8664299d11454546950
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Oct 3 19:29:48 2021 +0100
patch 8.2.3468: problem with :cd when editing file in non-existent directory
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 03 Oct 2021 20:30:03 +0200 |
parents | f165d99cda45 |
children | 8bcbff752864 |
line wrap: on
line diff
--- 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