aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2019-01-17 16:05:57 +0900
committerJustin M. Keyes <justinkz@gmail.com>2019-04-01 00:14:35 +0200
commit519b93d236ad2e9d35fe294acb020d93debf79a2 (patch)
tree920bfcf687a9dd3b8e7d4122a2aecb26de517c0a
parentd13803f64fc5607c6319087240e35a8b86082f64 (diff)
downloadrneovim-519b93d236ad2e9d35fe294acb020d93debf79a2.tar.gz
rneovim-519b93d236ad2e9d35fe294acb020d93debf79a2.tar.bz2
rneovim-519b93d236ad2e9d35fe294acb020d93debf79a2.zip
win: executable(): fix relative path bug
Qualified (i.e. dot-prefixed) relative paths should only search CWD, not $PATH.
-rw-r--r--src/nvim/os/fs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index 27db675c52..8f2324c554 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -242,9 +242,13 @@ bool os_can_exe(const char_u *name, char_u **abspath, bool use_path)
FUNC_ATTR_NONNULL_ARG(1)
{
bool no_path = !use_path || path_is_absolute(name);
-#ifndef WIN32
+#ifdef WIN32
// If the filename is "qualified" (relative or absolute) do not check $PATH.
no_path |= (name[0] == '.'
+ && ((name[1] == '/' || name[1] == '\\')
+ || (name[1] == '.' && (name[2] == '/' || name[2] == '\\'))));
+#else
+ no_path |= (name[0] == '.'
&& (name[1] == '/' || (name[1] == '.' && name[2] == '/')));
#endif