From e7b58b4e533a85f3f3dfc66f4d779f10e53b5467 Mon Sep 17 00:00:00 2001 From: Rui Abreu Ferreira Date: Tue, 12 May 2015 18:56:06 +0100 Subject: 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. --- src/nvim/os/fs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/nvim/os/fs.c') diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 785c79127f..3789da3b17 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -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; } -- cgit