From 519b93d236ad2e9d35fe294acb020d93debf79a2 Mon Sep 17 00:00:00 2001 From: erw7 Date: Thu, 17 Jan 2019 16:05:57 +0900 Subject: win: executable(): fix relative path bug Qualified (i.e. dot-prefixed) relative paths should only search CWD, not $PATH. --- src/nvim/os/fs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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,8 +242,12 @@ 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 -- cgit