diff options
author | Rui Abreu Ferreira <raf-ep@gmx.com> | 2015-05-12 18:56:06 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-08-23 23:53:24 -0400 |
commit | e7b58b4e533a85f3f3dfc66f4d779f10e53b5467 (patch) | |
tree | ebe3c3f8082bad231b6749a2e7746d4e85ed0fbb | |
parent | 5090d946998d5d407d64d29808fb0821586ddb17 (diff) | |
download | rneovim-e7b58b4e533a85f3f3dfc66f4d779f10e53b5467.tar.gz rneovim-e7b58b4e533a85f3f3dfc66f4d779f10e53b5467.tar.bz2 rneovim-e7b58b4e533a85f3f3dfc66f4d779f10e53b5467.zip |
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.
-rw-r--r-- | src/nvim/os/fs.c | 10 |
1 files changed, 7 insertions, 3 deletions
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; } |