diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-07-12 06:33:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-12 06:33:54 +0800 |
commit | 31d53cbb0fff48488f45ba234b8d595c31507739 (patch) | |
tree | 396fc28709e2f5696d2cea937be24b735b2aab63 /src | |
parent | 45b7a2c50335e1943a36715101e40eda5a1423f3 (diff) | |
download | rneovim-31d53cbb0fff48488f45ba234b8d595c31507739.tar.gz rneovim-31d53cbb0fff48488f45ba234b8d595c31507739.tar.bz2 rneovim-31d53cbb0fff48488f45ba234b8d595c31507739.zip |
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)
https://github.com/vim/vim/commit/4eaef9979fc5032606897963f1af37674ee0d422
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/path.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c index 1643264fee..770d15e2fc 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -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; } |