Merge pull request #2837 from tmatilai/vagrant_home

core: Respect VAGRANT_HOME everywhere
This commit is contained in:
Mitchell Hashimoto 2014-01-15 17:52:56 -08:00
commit 1bcc7158ac
2 changed files with 8 additions and 4 deletions

View File

@ -599,7 +599,7 @@ module Vagrant
# @return [Pathname] # @return [Pathname]
def setup_home_path def setup_home_path
@home_path = Util::Platform.fs_real_path( @home_path = Util::Platform.fs_real_path(
@home_path || ENV["VAGRANT_HOME"] || Vagrant.user_data_path) @home_path || Vagrant.user_data_path)
@logger.info("Home path: #{@home_path}") @logger.info("Home path: #{@home_path}")
# Setup the list of child directories that need to be created if they # Setup the list of child directories that need to be created if they

View File

@ -20,15 +20,19 @@ module Vagrant
# #
# @return [Pathname] # @return [Pathname]
def self.user_data_path def self.user_data_path
path = "~/.vagrant.d" # Use user spcified env var if available
path = ENV["VAGRANT_HOME"]
# On Windows, we default ot the USERPROFILE directory if it # On Windows, we default ot the USERPROFILE directory if it
# is available. This is more compatible with Cygwin and sharing # is available. This is more compatible with Cygwin and sharing
# the home directory across shells. # the home directory across shells.
if ENV["USERPROFILE"] if !path && ENV["USERPROFILE"]
path = "#{ENV["USERPROFILE"]}/.vagrant.d" path = "#{ENV["USERPROFILE"]}/.vagrant.d"
end end
return Pathname.new(path).expand_path # Fallback to the default
path ||= "~/.vagrant.d"
Pathname.new(path).expand_path
end end
end end