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)
5a664fe57f
This commit is contained in:
zeertzjq 2022-02-07 06:48:10 +08:00
parent bfc11e9c64
commit 72816136a5
2 changed files with 2 additions and 1 deletions

View File

@ -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]))

View File

@ -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)