aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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;
}