Don't rely on exceptions for data store file existence checking
This commit is contained in:
parent
d68b2a6615
commit
fa1726a801
|
@ -20,11 +20,12 @@ module Vagrant
|
||||||
return if !file_path
|
return if !file_path
|
||||||
|
|
||||||
raise Errors::DotfileIsDirectory if File.directory?(file_path)
|
raise Errors::DotfileIsDirectory if File.directory?(file_path)
|
||||||
|
|
||||||
|
if File.exist?(file_path)
|
||||||
File.open(file_path, "r") do |f|
|
File.open(file_path, "r") do |f|
|
||||||
merge!(JSON.parse(f.read))
|
merge!(JSON.parse(f.read))
|
||||||
end
|
end
|
||||||
rescue Errno::ENOENT
|
end
|
||||||
clear
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Commits any changes to the data to disk. Even if the data
|
# Commits any changes to the data to disk. Even if the data
|
||||||
|
|
Loading…
Reference in New Issue