From fb98145aa2446b3f86c6f1f34a7c732f99c7c186 Mon Sep 17 00:00:00 2001 From: Rui Abreu Ferreira Date: Sat, 13 Aug 2016 14:08:31 +0100 Subject: 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 --- src/nvim/path.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/nvim/path.c') 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; } -- cgit