aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-05-04 21:32:53 -0400
committerJustin M. Keyes <justinkz@gmail.com>2016-05-04 21:32:53 -0400
commita62cc5f807a6dc730c871c1fd53f29805a9cdc6e (patch)
tree03e26246b5a89ffcd584b0b33f69dbf857450344 /src/nvim/os
parente2cc3f98fb3ca771d9bd108ae9c37c19bea8025b (diff)
parent11f41a3c8c4b667b30db38875b37d5d25979003e (diff)
downloadrneovim-a62cc5f807a6dc730c871c1fd53f29805a9cdc6e.tar.gz
rneovim-a62cc5f807a6dc730c871c1fd53f29805a9cdc6e.tar.bz2
rneovim-a62cc5f807a6dc730c871c1fd53f29805a9cdc6e.zip
Merge pull request #4678 from KillTheMule/vim-7.4.672
vim-patch:7.4.672
Diffstat (limited to 'src/nvim/os')
-rw-r--r--src/nvim/os/fs.c12
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);
}