diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-02-02 13:16:15 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-02-04 11:07:49 +0100 |
commit | 224f99b85d311ebd31451db13b66e4a3c7e51938 (patch) | |
tree | de2bb4bc8f06e09ede603ae535697384133a4ed5 /src/nvim/os/fs.c | |
parent | 7d58aba80c6d81a9af40f54e566c0cdcea2de3e3 (diff) | |
download | rneovim-224f99b85d311ebd31451db13b66e4a3c7e51938.tar.gz rneovim-224f99b85d311ebd31451db13b66e4a3c7e51938.tar.bz2 rneovim-224f99b85d311ebd31451db13b66e4a3c7e51938.zip |
win: Append process dir to $PATH
This allows executables to be found by :!, system(), and executable() if
they live next to ("sibling" to) nvim.exe. This is what gvim on Windows
does, and also matches the behavior of Win32 SearchPath().
https://github.com/vim/vim/blob/c4a249a736d40ec54794827ef95804c225d0e38f/src/os_win32.c#L354-L370
Diffstat (limited to 'src/nvim/os/fs.c')
-rw-r--r-- | src/nvim/os/fs.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index b3d838c01a..4ca67d1f1a 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -224,7 +224,7 @@ bool os_can_exe(const char_u *name, char_u **abspath, bool use_path) if (!use_path || path_is_absolute_path(name) || (name[0] == '.' && (name[1] == '/' || (name[1] == '.' && name[2] == '/')))) { -#if WIN32 +#ifdef WIN32 bool ok = is_executable(name); #else // Must have path separator, cannot execute files in the current directory. @@ -255,7 +255,7 @@ static bool is_executable(const char_u *name) return false; } -#if WIN32 +#ifdef WIN32 // Windows does not have exec bit; just check if the file exists and is not // a directory. return (S_ISREG(mode)); @@ -281,7 +281,7 @@ static bool is_executable_in_path(const char_u *name, char_u **abspath) #ifdef WIN32 // Prepend ".;" to $PATH. size_t pathlen = strlen(path_env); - char *path = memcpy(xmallocz(pathlen + 3), ".;", 2); + char *path = memcpy(xmallocz(pathlen + 3), "." ENV_SEPSTR, 2); memcpy(path + 2, path_env, pathlen); #else char *path = xstrdup(path_env); @@ -1027,7 +1027,7 @@ shortcut_end: int os_translate_sys_error(int sys_errno) { #ifdef HAVE_UV_TRANSLATE_SYS_ERROR return uv_translate_sys_error(sys_errno); -#elif WIN32 +#elif defined(WIN32) // TODO(equalsraf): libuv does not yet expose uv_translate_sys_error() // in its public API, include a version here until it can be used. // See https://github.com/libuv/libuv/issues/79 |