Dir.exist? is not available on 1.8.7; use File.directory? instead