From 069a1c134855ed8abb0be70f651fbfc97a80a4c1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 10 Dec 2011 17:37:18 -0800 Subject: [PATCH] Try to actually create directory before showing home directory error --- lib/vagrant/environment.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index fd7dfef6c..dae8f8e07 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -468,11 +468,6 @@ module Vagrant DEFAULT_HOME)) @logger.info("Home path: #{@home_path}") - if !@home_path.readable? || !@home_path.writable? - @logger.error("Home directory not accessible") - raise Errors::HomeDirectoryNotAccessible, :home_path => @home_path.to_s - end - # Setup the array of necessary home directories dirs = [@home_path] dirs += HOME_SUBDIRS.collect { |subdir| @home_path.join(subdir) } @@ -481,8 +476,12 @@ module Vagrant dirs.each do |dir| next if File.directory?(dir) - @logger.info("Creating: #{dir}") - FileUtils.mkdir_p(dir) + begin + @logger.info("Creating: #{dir}") + FileUtils.mkdir_p(dir) + rescue Errno::EACCES + raise Errors::HomeDirectoryNotAccessible, :home_path => @home_path.to_s + end end end