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
|
||||
|
||||
raise Errors::DotfileIsDirectory if File.directory?(file_path)
|
||||
File.open(file_path, "r") do |f|
|
||||
merge!(JSON.parse(f.read))
|
||||
|
||||
if File.exist?(file_path)
|
||||
File.open(file_path, "r") do |f|
|
||||
merge!(JSON.parse(f.read))
|
||||
end
|
||||
end
|
||||
rescue Errno::ENOENT
|
||||
clear
|
||||
end
|
||||
|
||||
# Commits any changes to the data to disk. Even if the data
|
||||
|
|
Loading…
Reference in New Issue