Try to actually create directory before showing home directory error

This commit is contained in:
Mitchell Hashimoto 2011-12-10 17:37:18 -08:00
parent d9e2c8b788
commit 069a1c1348
1 changed files with 6 additions and 7 deletions

View File

@ -468,11 +468,6 @@ module Vagrant
DEFAULT_HOME)) DEFAULT_HOME))
@logger.info("Home path: #{@home_path}") @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 # Setup the array of necessary home directories
dirs = [@home_path] dirs = [@home_path]
dirs += HOME_SUBDIRS.collect { |subdir| @home_path.join(subdir) } dirs += HOME_SUBDIRS.collect { |subdir| @home_path.join(subdir) }
@ -481,8 +476,12 @@ module Vagrant
dirs.each do |dir| dirs.each do |dir|
next if File.directory?(dir) next if File.directory?(dir)
@logger.info("Creating: #{dir}") begin
FileUtils.mkdir_p(dir) @logger.info("Creating: #{dir}")
FileUtils.mkdir_p(dir)
rescue Errno::EACCES
raise Errors::HomeDirectoryNotAccessible, :home_path => @home_path.to_s
end
end end
end end