diff options
author | KillTheMule <KillTheMule@users.noreply.github.com> | 2016-04-29 21:17:06 +0200 |
---|---|---|
committer | KillTheMule <KillTheMule@users.noreply.github.com> | 2016-05-02 21:09:43 +0200 |
commit | 00c35ab3b4d8498c82776525de7b1afcd7b3424a (patch) | |
tree | fce72ff6c7a1adf88952c57ddb6c78246fc41c2d /src/nvim/os/fs.c | |
parent | d542de4a76dd9e600ebcf1405efdc9d3090ad9a8 (diff) | |
download | rneovim-00c35ab3b4d8498c82776525de7b1afcd7b3424a.tar.gz rneovim-00c35ab3b4d8498c82776525de7b1afcd7b3424a.tar.bz2 rneovim-00c35ab3b4d8498c82776525de7b1afcd7b3424a.zip |
vim-patch:7.4.672
Problem: When completing a shell command, directories in the current
directory are not listed.
Solution: When "." is not in $PATH also look in the current directory for
directories.
https://github.com/vim/vim/commit/b5971141dff0c69355fd64196fcc0d0d071d4c82
Most of it applied manually.
Diffstat (limited to 'src/nvim/os/fs.c')
-rw-r--r-- | src/nvim/os/fs.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index abb71a2c15..a9c9eb608b 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -164,6 +164,7 @@ int os_nodetype(const char *name) /// /// @param[in] name Name of the executable. /// @param[out] abspath Path of the executable, if found and not `NULL`. +/// @param[in] use_path If 'false', only check if "name" is executable /// /// @return `true` if `name` is executable and /// - can be found in $PATH, @@ -171,15 +172,18 @@ int os_nodetype(const char *name) /// - is absolute. /// /// @return `false` otherwise. -bool os_can_exe(const char_u *name, char_u **abspath) +bool os_can_exe(const char_u *name, char_u **abspath, bool use_path) FUNC_ATTR_NONNULL_ARG(1) { - // If it's an absolute or relative path don't need to use $PATH. - if (path_is_absolute_path(name) + // when use_path is false or if it's an absolute or relative path don't + // need to use $PATH. + if (!use_path || path_is_absolute_path(name) || (name[0] == '.' && (name[1] == '/' || (name[1] == '.' && name[2] == '/')))) { - if (is_executable(name)) { + // There must be a path separator, files in the current directory + // can't be executed + if (gettail_dir(name) != name && is_executable(name)) { if (abspath != NULL) { *abspath = save_absolute_path(name); } |