mirror of
https://github.com/StrawberryMaster/wayback-machine-downloader.git
synced 2025-12-18 10:16:47 +00:00
File.exists? causes warning is ruby 2.4.1, use exist?
This commit is contained in:
parent
d926f965f9
commit
e73a88ab56
@ -187,7 +187,7 @@ class WaybackMachineDownloader
|
|||||||
|
|
||||||
def structure_dir_path dir_path
|
def structure_dir_path dir_path
|
||||||
begin
|
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
|
rescue Errno::EEXIST => e
|
||||||
error_to_string = e.to_s
|
error_to_string = e.to_s
|
||||||
puts "# #{error_to_string}"
|
puts "# #{error_to_string}"
|
||||||
@ -227,7 +227,7 @@ class WaybackMachineDownloader
|
|||||||
if Gem.win_platform?
|
if Gem.win_platform?
|
||||||
file_path = file_path.gsub(/[:*?&=<>\\|]/) {|s| '%' + s.ord.to_s(16) }
|
file_path = file_path.gsub(/[:*?&=<>\\|]/) {|s| '%' + s.ord.to_s(16) }
|
||||||
end
|
end
|
||||||
unless File.exists? file_path
|
unless File.exist? file_path
|
||||||
begin
|
begin
|
||||||
structure_dir_path dir_path
|
structure_dir_path dir_path
|
||||||
open(file_path, "wb") do |file|
|
open(file_path, "wb") do |file|
|
||||||
@ -248,7 +248,7 @@ class WaybackMachineDownloader
|
|||||||
rescue StandardError => e
|
rescue StandardError => e
|
||||||
puts "#{file_url} # #{e}"
|
puts "#{file_url} # #{e}"
|
||||||
ensure
|
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)
|
File.delete(file_path)
|
||||||
puts "#{file_path} was empty and was removed."
|
puts "#{file_path} was empty and was removed."
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user