mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
vim-patch:9.1.0569: fnamemodify() treats ".." and "../" differently (#29673)
Problem: fnamemodify() treats ".." and "../" differently.
Solution: Expand ".." properly like how "/.." is treated in 8.2.3388.
(zeertzjq)
closes: vim/vim#15218
1ee7420460
This commit is contained in:
@@ -2393,9 +2393,13 @@ static int path_to_absolute(const char *fname, char *buf, size_t len, int force)
|
||||
p = strrchr(fname, '\\');
|
||||
}
|
||||
#endif
|
||||
if (p == NULL && strcmp(fname, "..") == 0) {
|
||||
// Handle ".." without path separators.
|
||||
p = fname + 2;
|
||||
}
|
||||
if (p != NULL) {
|
||||
if (strcmp(p + 1, "..") == 0) {
|
||||
// for "/path/dir/.." include the "/.."
|
||||
if (vim_ispathsep_nocolon(*p) && strcmp(p + 1, "..") == 0) {
|
||||
// For "/path/dir/.." include the "/..".
|
||||
p += 3;
|
||||
}
|
||||
assert(p >= fname);
|
||||
|
Reference in New Issue
Block a user