diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-02-07 06:48:10 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-02-07 06:48:10 +0800 |
commit | 72816136a57adbd051c688ee3213fa9446ea48f6 (patch) | |
tree | 56a429f22215a8cca22dbca44b35135d508a8b30 | |
parent | bfc11e9c64f7da952fb3f6c0ee0f62d80ce4394a (diff) | |
download | rneovim-72816136a57adbd051c688ee3213fa9446ea48f6.tar.gz rneovim-72816136a57adbd051c688ee3213fa9446ea48f6.tar.bz2 rneovim-72816136a57adbd051c688ee3213fa9446ea48f6.zip |
vim-patch:8.2.3939: MS-Windows: fnamemodify('', ':p') does not work
Problem: MS-Windows: fnamemodify('', ':p') does not work.
Solution: Do not consider an empty string a full path. (Yegappan Lakshmanan,
closes vim/vim#9428, closes vim/vim#9427)
https://github.com/vim/vim/commit/5a664fe57fe7ba65a771bc95ef1c205e4db193b7
-rw-r--r-- | src/nvim/path.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_fnamemodify.vim | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c index 54170e7a8b..7f7f941e26 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -2403,7 +2403,7 @@ int path_is_absolute(const char_u *fname) { #ifdef WIN32 if (*fname == NUL) { - return true; + return false; } // A name like "d:/foo" and "//server/share" is absolute return ((isalpha(fname[0]) && fname[1] == ':' && vim_ispathsep_nocolon(fname[2])) diff --git a/src/nvim/testdir/test_fnamemodify.vim b/src/nvim/testdir/test_fnamemodify.vim index 73ede415ae..5ae2a5ee17 100644 --- a/src/nvim/testdir/test_fnamemodify.vim +++ b/src/nvim/testdir/test_fnamemodify.vim @@ -29,6 +29,7 @@ func Test_fnamemodify() call assert_equal('fb2.tar.gz', fnamemodify('abc.fb2.tar.gz', ':e:e:e')) call assert_equal('fb2.tar.gz', fnamemodify('abc.fb2.tar.gz', ':e:e:e:e')) call assert_equal('tar', fnamemodify('abc.fb2.tar.gz', ':e:e:r')) + call assert_equal(getcwd(), fnamemodify('', ':p:h')) let cwd = getcwd() call chdir($HOME) |