diff options
author | Rui Abreu Ferreira <equalsraf@users.noreply.github.com> | 2016-08-13 14:08:31 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-08-13 09:08:31 -0400 |
commit | fb98145aa2446b3f86c6f1f34a7c732f99c7c186 (patch) | |
tree | 5a145deee3ffc8d15945dda345c74a93c8058f0b | |
parent | 79ef4b72d7cadb094aec35ec26dce2e8bfcda417 (diff) | |
download | rneovim-fb98145aa2446b3f86c6f1f34a7c732f99c7c186.tar.gz rneovim-fb98145aa2446b3f86c6f1f34a7c732f99c7c186.tar.bz2 rneovim-fb98145aa2446b3f86c6f1f34a7c732f99c7c186.zip |
Windows: get_past_head() (#5199)
Reported in #4955, get_past_head() is supposed to return a pointer
after the head of the path (/ in UNIX, c:\ in Windows) but the windows
case was removed.
Removed the Mac reference in the comment, since there no special
handling for Mac.
vim-patch:0
-rw-r--r-- | src/nvim/path.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c index e09d9ac059..c20dffa9b1 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -172,19 +172,23 @@ char_u *path_next_component(char_u *fname) return fname; } -/* - * Get a pointer to one character past the head of a path name. - * Unix: after "/"; DOS: after "c:\"; Mac: no head. - * If there is no head, path is returned. - */ +/// Get a pointer to one character past the head of a path name. +/// Unix: after "/"; Win: after "c:\" +/// If there is no head, path is returned. char_u *get_past_head(char_u *path) { - char_u *retval; + char_u *retval = path; - retval = path; +#ifdef WIN32 + // May skip "c:" + if (isalpha(path[0]) && path[1] == ':') { + retval = path + 2; + } +#endif - while (vim_ispathsep(*retval)) + while (vim_ispathsep(*retval)) { ++retval; + } return retval; } |