Skip to content

Commit

Permalink
File.exists? causes warning is ruby 2.4.1, use exist?
Browse files Browse the repository at this point in the history
  • Loading branch information
p committed Jun 3, 2017
1 parent d926f96 commit e73a88a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/wayback_machine_downloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def download_files

def structure_dir_path dir_path
begin
FileUtils::mkdir_p dir_path unless File.exists? dir_path
FileUtils::mkdir_p dir_path unless File.exist? dir_path
rescue Errno::EEXIST => e
error_to_string = e.to_s
puts "# #{error_to_string}"
Expand Down Expand Up @@ -227,7 +227,7 @@ def download_file file_remote_info
if Gem.win_platform?
file_path = file_path.gsub(/[:*?&=<>\\|]/) {|s| '%' + s.ord.to_s(16) }
end
unless File.exists? file_path
unless File.exist? file_path
begin
structure_dir_path dir_path
open(file_path, "wb") do |file|
Expand All @@ -248,7 +248,7 @@ def download_file file_remote_info
rescue StandardError => e
puts "#{file_url} # #{e}"
ensure
if not @all and File.exists?(file_path) and File.size(file_path) == 0
if not @all and File.exist?(file_path) and File.size(file_path) == 0
File.delete(file_path)
puts "#{file_path} was empty and was removed."
end
Expand Down

0 comments on commit e73a88a

Please sign in to comment.