Don't rely on exceptions for data store file existence checking

This commit is contained in:
Mitchell Hashimoto 2011-01-29 20:52:56 -08:00
parent d68b2a6615
commit fa1726a801
1 changed files with 5 additions and 4 deletions

View File

@ -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