uv.fs_scandir skips dotfiles
haolian9 opened this issue · comments
(sorry if i have opened a upstream issue here.)
in my use, uv.fs_scandir and uv.fs_scandir_next do not return files startswith .
, i can neither find a flag in their function signature. is this feature addable?
This is a libuv limitation, see https://docs.libuv.org/en/v1.x/fs.html#c.uv_fs_scandir_next:
Note: Unlike scandir(3), this function does not return the “.” and “..” entries.
Edit: nevermind, it looks like you're looking for files starting with .
, which fs_scandir_next
should be picking up, this works for me.
To be clear, do you mean .
and ..
or files with a dot prefix (e.g. .something
)?
thanks!
oh, sorry i just missed your comment. i mean to "files with a dot prefix (e.g. .something)".
That should work.
local uv = require('luv')
assert(uv.fs_scandir('.', function(err, req)
assert(not err)
local function iter()
return uv.fs_scandir_next(req)
end
for name, ftype in iter do
print(name, ftype)
end
end))
uv.run()
from within a cloned luv
repo gives me:
.ci directory
.clang-format file
.clangd file
.editorconfig file
.git directory
.github directory
.gitignore file
.gitmodules file
CMakeLists.txt file
LICENSE.txt file
Makefile file
README.md file
appveyor.yml file
build directory
cmake directory
deps directory
docs.md file
... (truncated)
thanks for the example!