core: Respect VAGRANT_HOME everywhere

Use `VAGRANT_HOME`env var also for `Plugin::Manager` etc., not only in
the `Environment` class.
This commit is contained in:
Teemu Matilainen 2014-01-15 19:15:49 -03:00
parent e2ec46bb4d
commit 1a69306839
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