Skip to content

Commit

Permalink
fix(base): fs_iterdir bug when skip_dir is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
pysan3 committed Feb 18, 2024
1 parent e463807 commit da7f101
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/pathlib/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ function Path:fs_iterdir(follow_symlinks, depth, skip_dir)
if not handler then
handler = self.nuv.fs_scandir(current:tostring())
if not handler then
return handler
return nil
end
end
local name, fs_type = vim.loop.fs_scandir_next(handler)
Expand All @@ -849,7 +849,7 @@ function Path:fs_iterdir(follow_symlinks, depth, skip_dir)
child = child:realpath() or child
fs_type = (child:lstat() or { type = "file" }).type
end
if fs_type == "directory" and (depth < 0 or depths[i_dir] < depth) and (skip_dir and not skip_dir(child)) then
if fs_type == "directory" and (depth < 0 or depths[i_dir] < depth) and (not skip_dir or not skip_dir(child)) then
last_index = last_index + 1
paths[last_index] = child
depths[last_index] = depths[i_dir] + 1
Expand Down

0 comments on commit da7f101

Please sign in to comment.