mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
updated for version 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.
This commit is contained in:
@@ -3104,22 +3104,27 @@ executable_file(name)
|
||||
|
||||
/*
|
||||
* Return 1 if "name" can be found in $PATH and executed, 0 if not.
|
||||
* If "use_path" is FALSE only check if "name" is executable.
|
||||
* Return -1 if unknown.
|
||||
*/
|
||||
int
|
||||
mch_can_exe(name, path)
|
||||
mch_can_exe(name, path, use_path)
|
||||
char_u *name;
|
||||
char_u **path;
|
||||
int use_path;
|
||||
{
|
||||
char_u *buf;
|
||||
char_u *p, *e;
|
||||
int retval;
|
||||
|
||||
/* If it's an absolute or relative path don't need to use $PATH. */
|
||||
if (mch_isFullName(name) || (name[0] == '.' && (name[1] == '/'
|
||||
|| (name[1] == '.' && name[2] == '/'))))
|
||||
/* When "use_path" is false and if it's an absolute or relative path don't
|
||||
* need to use $PATH. */
|
||||
if (!use_path || mch_isFullName(name) || (name[0] == '.'
|
||||
&& (name[1] == '/' || (name[1] == '.' && name[2] == '/'))))
|
||||
{
|
||||
if (executable_file(name))
|
||||
/* There must be a path separator, files in the current directory
|
||||
* can't be executed. */
|
||||
if (gettail(name) != name && executable_file(name))
|
||||
{
|
||||
if (path != NULL)
|
||||
{
|
||||
@@ -5730,7 +5735,8 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags)
|
||||
continue;
|
||||
|
||||
/* Skip files that are not executable if we check for that. */
|
||||
if (!dir && (flags & EW_EXEC) && !mch_can_exe(p, NULL))
|
||||
if (!dir && (flags & EW_EXEC)
|
||||
&& !mch_can_exe(p, NULL, !(flags & EW_SHELLCMD)))
|
||||
continue;
|
||||
|
||||
if (--files_free == 0)
|
||||
@@ -6230,7 +6236,8 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags)
|
||||
continue;
|
||||
|
||||
/* Skip files that are not executable if we check for that. */
|
||||
if (!dir && (flags & EW_EXEC) && !mch_can_exe((*file)[i], NULL))
|
||||
if (!dir && (flags & EW_EXEC)
|
||||
&& !mch_can_exe((*file)[i], NULL, !(flags & EW_SHELLCMD)))
|
||||
continue;
|
||||
|
||||
p = alloc((unsigned)(STRLEN((*file)[i]) + 1 + dir));
|
||||
|
Reference in New Issue
Block a user