aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Abreu Ferreira <equalsraf@users.noreply.github.com>2016-08-13 14:08:31 +0100
committerJustin M. Keyes <justinkz@gmail.com>2016-08-13 09:08:31 -0400
commitfb98145aa2446b3f86c6f1f34a7c732f99c7c186 (patch)
tree5a145deee3ffc8d15945dda345c74a93c8058f0b
parent79ef4b72d7cadb094aec35ec26dce2e8bfcda417 (diff)
downloadrneovim-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.c20
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;
}