diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2015-09-18 15:12:12 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2015-09-18 15:12:12 -0300 |
commit | e80d7c0df7ec6e88a964e58d86a70c8f980e4cc1 (patch) | |
tree | 0037b05c1a27aaaf31c038a32f3a64100a8f3ccf /src/nvim/path.c | |
parent | a4c41735359d0114e678cbf4888c514f604f01dd (diff) | |
parent | e897ccad3eb1eb8d423766300be9c6055fcd1d9f (diff) | |
download | rneovim-e80d7c0df7ec6e88a964e58d86a70c8f980e4cc1.tar.gz rneovim-e80d7c0df7ec6e88a964e58d86a70c8f980e4cc1.tar.bz2 rneovim-e80d7c0df7ec6e88a964e58d86a70c8f980e4cc1.zip |
Merge PR #3309 'Fixes for 0.1'
Diffstat (limited to 'src/nvim/path.c')
-rw-r--r-- | src/nvim/path.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c index 1a1f15e8f3..45ae12b78a 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -2089,8 +2089,15 @@ static int path_get_absolute_path(const char_u *fname, char_u *buf, int len, int // expand it if forced or not an absolute path if (force || !path_is_absolute_path(fname)) { if ((p = vim_strrchr(fname, '/')) != NULL) { - STRNCPY(relative_directory, fname, p-fname); - relative_directory[p-fname] = NUL; + // relative to root + if (p == fname) { + // only one path component + relative_directory[0] = '/'; + relative_directory[1] = NUL; + } else { + STRNCPY(relative_directory, fname, p-fname); + relative_directory[p-fname] = NUL; + } end_of_path = (char *) (p + 1); } else { relative_directory[0] = NUL; |