lib/chromedriver_update.rb in chromedriver_update-0.1.6 vs lib/chromedriver_update.rb in chromedriver_update-0.1.7
- old
+ new
@@ -22,9 +22,10 @@
chromedriver_zip = HTTParty.get(chromedriver_link_for_version(installed_chrome_version))
if chromedriver_zip.code == 404 # fallback to latest lower version
chromedriver_zip = HTTParty.get(chromedriver_closest_link_for_version(installed_chrome_version))
end
destination_dir = File.expand_path(File.dirname(__FILE__) + "/../tmp")
+ FileUtils.mkdir_p destination_dir
Zip::File.open_buffer(chromedriver_zip.body) do |zip_files|
zip_files.each do |entry|
if (entry.name.end_with?("/chromedriver") || entry.name.end_with?("/chromedriver.exe"))
download_path = File.join(destination_dir, File.basename(entry.name))
FileUtils.rm_f(download_path)