aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Abreu Ferreira <raf-ep@gmx.com>2015-05-12 18:56:06 +0100
committerJustin M. Keyes <justinkz@gmail.com>2015-08-23 23:53:24 -0400
commite7b58b4e533a85f3f3dfc66f4d779f10e53b5467 (patch)
treeebe3c3f8082bad231b6749a2e7746d4e85ed0fbb
parent5090d946998d5d407d64d29808fb0821586ddb17 (diff)
downloadrneovim-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.c10
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;
}