diff --git a/src/library/library.cr b/src/library/library.cr index 93eac0c..2a5de7d 100644 --- a/src/library/library.cr +++ b/src/library/library.cr @@ -136,8 +136,12 @@ class Library deleted_entry_ids: [] of String, } + library_paths = (Dir.entries @dir) + .select { |fn| !fn.starts_with? "." } + .map { |fn| File.join @dir, fn } @title_ids.select! do |title_id| title = @title_hash[title_id] + next false unless library_paths.includes? title.dir existence = title.examine examine_context unless existence examine_context["deleted_title_ids"].concat [title_id] + @@ -152,9 +156,7 @@ class Library end cache = examine_context["cached_contents_signature"] - (Dir.entries @dir) - .select { |fn| !fn.starts_with? "." } - .map { |fn| File.join @dir, fn } + library_paths .select { |path| !(remained_title_dirs.includes? path) } .select { |path| File.directory? path } .map { |path| Title.new path, "", cache }