diff options
author | Rui Abreu Ferreira <raf-ep@gmx.com> | 2015-05-12 17:46:34 +0100 |
---|---|---|
committer | Rui Abreu Ferreira <raf-ep@gmx.com> | 2016-08-09 13:14:43 +0100 |
commit | e30b2c2054442ca2f23dcfb5c58a70351d0c00e3 (patch) | |
tree | cd538a218a9aca4f563dc0adaf2bd6dc4d4de54f | |
parent | 006f9c0c9c96a406b610b9b76ff58b88f70ed674 (diff) | |
download | rneovim-e30b2c2054442ca2f23dcfb5c58a70351d0c00e3.tar.gz rneovim-e30b2c2054442ca2f23dcfb5c58a70351d0c00e3.tar.bz2 rneovim-e30b2c2054442ca2f23dcfb5c58a70351d0c00e3.zip |
Windows: Don't use literal path separators
Per #2471, some path handling functions hardcode the UNIX path
separator '/' causing them to fail in Windows.
When BLACKSLASH_IN_FILENAME is set we may have to check against
psepc and psepcN instead of PATHSEP or use vim_ispathsep_nocolon().
-rw-r--r-- | src/nvim/path.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c index 57499429ec..e09d9ac059 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -562,11 +562,12 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, while (*path_end != NUL) { /* May ignore a wildcard that has a backslash before it; it will * be removed by rem_backslash() or file_pat_to_reg_pat() below. */ - if (path_end >= path + wildoff && rem_backslash(path_end)) + if (path_end >= path + wildoff && rem_backslash(path_end)) { *p++ = *path_end++; - else if (*path_end == '/') { - if (e != NULL) + } else if (vim_ispathsep_nocolon(*path_end)) { + if (e != NULL) { break; + } s = p + 1; } else if (path_end >= path + wildoff && (vim_strchr((char_u *)"*?[{~$", *path_end) != NULL @@ -2099,7 +2100,6 @@ int path_full_dir_name(char *directory, char *buffer, size_t len) } // Append to_append to path with a slash in between. -// Append to_append to path with a slash in between. int append_path(char *path, const char *to_append, size_t max_len) { size_t current_length = strlen(path); @@ -2116,7 +2116,7 @@ int append_path(char *path, const char *to_append, size_t max_len) } // Glue both paths with a slash. - if (current_length > 0 && path[current_length-1] != '/') { + if (current_length > 0 && !vim_ispathsep_nocolon(path[current_length-1])) { current_length += 1; // Count the trailing slash. // +1 for the NUL at the end. @@ -2124,7 +2124,7 @@ int append_path(char *path, const char *to_append, size_t max_len) return FAIL; } - STRCAT(path, "/"); + STRCAT(path, PATHSEPSTR); } // +1 for the NUL at the end. |