Clear title ID at the end of scans

This minimizes the chance of getting an unexpected empty home page
This commit is contained in:
Alex Ling 2020-08-10 11:45:50 +00:00
parent 3cdd4b29a5
commit 68b1923cb6

View File

@ -92,7 +92,6 @@ class Library
"Attempting to create it"
Dir.mkdir_p @dir
end
@title_ids.clear
storage = Storage.new auto_close: false
@ -103,6 +102,7 @@ class Library
.map { |path| Title.new path, "", storage, self }
.select { |title| !(title.entries.empty? && title.titles.empty?) }
.sort { |a, b| a.title <=> b.title }
.tap { |_| @title_ids.clear }
.each do |title|
@title_hash[title.id] = title
@title_ids << title.id