mirror of
https://github.com/neovim/neovim.git
synced 2025-10-15 22:36:09 +00:00
vim-patch:8.1.1740: exepath() doesn't work for "bin/cat" (#10556)
Problem: Exepath() doesn't work for "bin/cat".
Solution: Check for any path separator. (Daniel Hahler, closes vim/vim#4724,
closes vim/vim#4710)
d08b8c4c04
Fixes https://github.com/neovim/neovim/issues/10554.
This commit is contained in:
@@ -242,23 +242,12 @@ int os_exepath(char *buffer, size_t *size)
|
||||
bool os_can_exe(const char *name, char **abspath, bool use_path)
|
||||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
bool no_path = !use_path || path_is_absolute((char_u *)name);
|
||||
// If the filename is "qualified" (relative or absolute) do not check $PATH.
|
||||
#ifdef WIN32
|
||||
no_path |= (name[0] == '.'
|
||||
&& ((name[1] == '/' || name[1] == '\\')
|
||||
|| (name[1] == '.' && (name[2] == '/' || name[2] == '\\'))));
|
||||
#else
|
||||
no_path |= (name[0] == '.'
|
||||
&& (name[1] == '/' || (name[1] == '.' && name[2] == '/')));
|
||||
#endif
|
||||
|
||||
if (no_path) {
|
||||
if (!use_path || gettail_dir(name) != name) {
|
||||
#ifdef WIN32
|
||||
if (is_executable_ext(name, abspath)) {
|
||||
#else
|
||||
// Must have path separator, cannot execute files in the current directory.
|
||||
if (gettail_dir(name) != name
|
||||
if ((use_path || gettail_dir(name) != name)
|
||||
&& is_executable(name, abspath)) {
|
||||
#endif
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user