Closed Dr-Emann closed 1 year ago
I don't understand the use cases yet. Why is it important to know you're at the last item?
But I just noticed, that _next
is completely broken as it always returns 0 until an error occurs. I'll fix that.
Fixed in #118, aligned the walker API to other iterators in #119.
Perfect, thank you, that's exactly what I was asking for, to be able to tell when _next
did nothing because it is already at the end of the directory.
Describe the bug
sqsh_tree_walker_next
returns 0 when it reaches the end of the directory.I believe the best way currently to tell if we're at the end is to save off the last name, and compare to the name after calling
sqsh_tree_walker_next
, or open a file from the tree walker, and compare e.g. inode or inode_ref.Maybe exposing a
sqsh_tree_walker_inode_ref
to get the inode ref of the current item would at least doing that sort of check more efficient?To Reproduce
Call
sqsh_tree_walker_next
on a new walker repeatedly, and observe the return value is always 0.Expected behavior
There should be an easier way to tell if the walker is not actually advancing to the next entry because there are none left.