mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 21:25:04 -07:00
fs.c: fix is_executable_ext
- Fix the problem of checking the extension in a UNIX like shell. - Fix the problem of not checking the existence of the file when the pathext contains an extension.
This commit is contained in:
parent
7d61b2f64f
commit
a7cc18e563
@ -331,10 +331,12 @@ static bool is_executable_ext(char *name, const char *pathext, char_u **abspath)
|
||||
const char *ext_end = xstrchrnul(ext, ENV_SEPCHAR);
|
||||
size_t ext_len = (size_t)(ext_end - ext);
|
||||
STRLCPY(buf_end, ext, ext_len + 1);
|
||||
bool in_pathext = nameext_len == ext_len
|
||||
&& 0 == mb_strnicmp((char_u *)nameext, (char_u *)ext, ext_len);
|
||||
bool in_pathext = (strstr((char *)path_tail(p_sh), "sh") != NULL)
|
||||
|| (nameext_len == ext_len
|
||||
&& 0 == mb_strnicmp((char_u *)nameext, (char_u *)ext, ext_len));
|
||||
|
||||
if (in_pathext || is_executable(os_buf, abspath)) {
|
||||
if ((in_pathext && is_executable(name, abspath))
|
||||
|| is_executable(os_buf, abspath)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user