Removing "." and ".." directories while walking the FS the right way (#entries -> #children).

master
Philippe PITTOLI 2024-07-02 16:59:17 +02:00
parent 179d5e6e17
commit 19d878e21c
2 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
name: dodb name: dodb
version: 0.5.0 version: 0.5.1
authors: authors:
- Luka Vandervelden <lukc@upyum.com> - Luka Vandervelden <lukc@upyum.com>

View File

@ -438,7 +438,7 @@ abstract class DODB::Storage(V)
# Lists all the keys in the database. # Lists all the keys in the database.
private def each_key(reversed = false) private def each_key(reversed = false)
# Removes the first two "." and ".." directories. # Removes the first two "." and ".." directories.
keys = Dir.entries(data_path).[2..].map(&.to_i).sort keys = Dir.children(data_path).map(&.to_i).sort
(reversed ? keys.reverse : keys).each do |key| (reversed ? keys.reverse : keys).each do |key|
yield key yield key
end end