Skip to content

Commit

Permalink
fix(path): don't remove trailing slash when getting absolute path
Browse files Browse the repository at this point in the history
Before Vim patch 8.2.3468 relative_directory is never used in the
resulting path name, so whether it has a trailing slash didn't matter.
Now path_full_dir_name() appends a non-existing relative directory to
the current directory name, so the trailing slash needs to be kept.
  • Loading branch information
zeertzjq committed Oct 28, 2022
1 parent 49e32cb commit 0e54f91
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/nvim/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -2362,16 +2362,9 @@ static int path_to_absolute(const char *fname, char *buf, size_t len, int force)
}
#endif
if (p != NULL) {
// relative to root
if (p == fname) {
// only one path component
relative_directory[0] = PATHSEP;
relative_directory[1] = NUL;
} else {
assert(p >= fname);
memcpy(relative_directory, fname, (size_t)(p - fname));
relative_directory[p - fname] = NUL;
}
assert(p >= fname);
memcpy(relative_directory, fname, (size_t)(p - fname + 1));
relative_directory[p - fname + 1] = NUL;
end_of_path = p + 1;
} else {
relative_directory[0] = NUL;
Expand Down

0 comments on commit 0e54f91

Please sign in to comment.