Windows: is_executable(): do not check exec bit.

In Windows there is no equivalent to the filesystem executable bit; the
documentation states that for Windows :executable() returns
1 for all files. But this behaviour was broken because is_executable()
checked for the UNIX bit.

When WIN32 is defined we now skip the S_IXUSR check.
This commit is contained in:
Rui Abreu Ferreira 2015-05-12 18:56:06 +01:00 committed by Justin M. Keyes
parent 5090d94699
commit e7b58b4e53

View File

@ -120,9 +120,13 @@ static bool is_executable(const char_u *name)
return false;
}
if (S_ISREG(mode) && (S_IXUSR & mode)) {
return true;
}
#if WIN32
// Windows does not have exec bit; just check if the file exists and is not
// a directory.
return (S_ISREG(mode));
#else
return (S_ISREG(mode) && (S_IXUSR & mode));
#endif
return false;
}