File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 11local vim = vim
22local log = require (" neo-tree.log" )
33local bit = require (" bit" )
4- local ffi = require ( " ffi" )
4+ local ffi_available , ffi = pcall ( require , " ffi" )
55
66local FILE_ATTRIBUTE_HIDDEN = 0x2
77
8- ffi .cdef ([[
9- int GetFileAttributesA(const char *path);
10- ]] )
8+ if ffi_available then
9+ ffi .cdef ([[
10+ int GetFileAttributesA(const char *path);
11+ ]] )
12+ end
1113
1214-- Backwards compatibility
1315table .pack = table.pack or function (...)
@@ -923,10 +925,11 @@ end
923925--- @param path string
924926--- @return boolean
925927function M .is_hidden (path )
926- if not M .is_windows then
928+ if ffi_available and M .is_windows then
929+ return bit .band (ffi .C .GetFileAttributesA (path ), FILE_ATTRIBUTE_HIDDEN ) ~= 0
930+ else
927931 return false
928932 end
929- return bit .band (ffi .C .GetFileAttributesA (path ), FILE_ATTRIBUTE_HIDDEN ) ~= 0
930933end
931934
932935--- Returns a new list that is the result of dedeuplicating a list.
You can’t perform that action at this time.
0 commit comments