From 72816136a57adbd051c688ee3213fa9446ea48f6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 7 Feb 2022 06:48:10 +0800 Subject: 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 --- src/nvim/path.c | 2 +- src/nvim/testdir/test_fnamemodify.vim | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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) -- cgit