mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +00:00
vim-patch:8.2.3388: fnamemodify('path/..', ':p') differs from using 'path/../' (#29667)
Problem: fnamemodify('path/..', ':p') differs from using 'path/../'.
Solution: Include the "/.." in the directory name. (closes vim/vim#8808)
4eaef9979f
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -2385,10 +2385,14 @@ static int path_to_absolute(const char *fname, char *buf, size_t len, int force)
|
||||
}
|
||||
#endif
|
||||
if (p != NULL) {
|
||||
if (strcmp(p + 1, "..") == 0) {
|
||||
// for "/path/dir/.." include the "/.."
|
||||
p += 3;
|
||||
}
|
||||
assert(p >= fname);
|
||||
memcpy(relative_directory, fname, (size_t)(p - fname + 1));
|
||||
relative_directory[p - fname + 1] = NUL;
|
||||
end_of_path = p + 1;
|
||||
end_of_path = (vim_ispathsep_nocolon(*p) ? p + 1 : p);
|
||||
} else {
|
||||
relative_directory[0] = NUL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user