# and Mrs. Pollifax volume 6, On the China Station, is
# .../DorothyGilman/P06_On_the_China_Station.epub.
-require './book.rb'
+require 'book'
+require 'store'
class WalkDir
- def initialize(root)
+ def initialize(store, root)
@root = root
+ @store = store
@files = walk(@root)
end
def books
result = []
- for file in @files
+ for file in @files.sort
if Book.canHandle?(file)
book = Book.new(file)
+ @store.store_book(book)
result.push(book)
end
end
children = Dir.entries(path)
for child in children
fullName = (path.chomp("/")) + "/" + child
- if (File.directory?(fullName)) and (child != ".") and (child != "..")
+ if (File.directory?(fullName)) and (child != ".") and (child != "..") and (!File.symlink?(fullName))
sub = walk(fullName)
if (sub != nil) and (sub.length > 0)
result.concat(sub)
result.push(fullName)
end
end
+ #puts result
return result
end
end