From 909c967f35c3d38be6d98d7dba6cfd087a6542f4 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 11 Jan 2018 11:35:07 -0500 Subject: win: detect / and \ as root path separator --- src/nvim/path.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/path.c b/src/nvim/path.c index 09cede8805..d18d9ecace 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -2202,7 +2202,11 @@ static int path_get_absolute_path(const char_u *fname, char_u *buf, // expand it if forced or not an absolute path if (force || !path_is_absolute_path(fname)) { - if ((p = vim_strrchr(fname, PATHSEP)) != NULL) { + p = vim_strrchr(fname, "/") +#ifdef WIN32 + if (p == NULL) p = vim_strrchr(fname, "\\") +#endif + if (p != NULL) { // relative to root if (p == fname) { // only one path component -- cgit From e39be42c0998d8048354961cd7a0864111c01e0b Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 11 Jan 2018 11:56:29 -0500 Subject: fixup: compile-time errors --- src/nvim/path.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/path.c b/src/nvim/path.c index d18d9ecace..8e4f72be68 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -2202,9 +2202,9 @@ static int path_get_absolute_path(const char_u *fname, char_u *buf, // expand it if forced or not an absolute path if (force || !path_is_absolute_path(fname)) { - p = vim_strrchr(fname, "/") + p = vim_strrchr(fname, PATHSEP); #ifdef WIN32 - if (p == NULL) p = vim_strrchr(fname, "\\") + if (p == NULL) p = vim_strrchr(fname, '/'); #endif if (p != NULL) { // relative to root -- cgit From ec5af91b90a6e1d7b8e6f789c3d435316391a4c6 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 11 Jan 2018 16:27:10 -0500 Subject: win: explicitly specify pathsep --- src/nvim/path.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/path.c b/src/nvim/path.c index 8e4f72be68..d8f5163ed0 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -2202,9 +2202,9 @@ static int path_get_absolute_path(const char_u *fname, char_u *buf, // expand it if forced or not an absolute path if (force || !path_is_absolute_path(fname)) { - p = vim_strrchr(fname, PATHSEP); + p = vim_strrchr(fname, '/'); #ifdef WIN32 - if (p == NULL) p = vim_strrchr(fname, '/'); + if (p == NULL) p = vim_strrchr(fname, '\\'); #endif if (p != NULL) { // relative to root -- cgit From 273c7cfa2a01430411ce4c58c354e42337c6e6a7 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 11 Jan 2018 17:35:36 -0500 Subject: fixup: lint errors --- src/nvim/path.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/path.c b/src/nvim/path.c index d8f5163ed0..21ac064c30 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -2204,7 +2204,9 @@ static int path_get_absolute_path(const char_u *fname, char_u *buf, if (force || !path_is_absolute_path(fname)) { p = vim_strrchr(fname, '/'); #ifdef WIN32 - if (p == NULL) p = vim_strrchr(fname, '\\'); + if (p == NULL) { + p = vim_strrchr(fname, '\\'); + } #endif if (p != NULL) { // relative to root -- cgit