This looks cleaner

This commit is contained in:
Carlos Rodrigues 2016-07-24 19:01:54 +01:00
parent 6b49d505d4
commit 218b697d5e
2 changed files with 6 additions and 5 deletions

View File

@ -159,10 +159,13 @@ module Vagrant
# Setup the local data directory. If a configuration path is given,
# it is expanded relative to the root path. Otherwise, we use the
# default (which is also expanded relative to the root path).
if ENV.has_key?("VAGRANT_DOTFILE_PATH") && !opts[:child]
opts[:local_data_path] ||= root_path.join(ENV["VAGRANT_DOTFILE_PATH"]) if !root_path.nil?
if !root_path.nil?
if !(ENV["VAGRANT_DOTFILE_PATH"] or "").empty? && !opts[:child]
opts[:local_data_path] ||= root_path.join(ENV["VAGRANT_DOTFILE_PATH"])
else
opts[:local_data_path] ||= root_path.join(DEFAULT_LOCAL_DATA)
end
end
opts[:local_data_path] ||= root_path.join(DEFAULT_LOCAL_DATA) if !root_path.nil?
if opts[:local_data_path]
@local_data_path = Pathname.new(File.expand_path(opts[:local_data_path], @cwd))
end

View File

@ -68,8 +68,6 @@ a scripting environment in order to set the directory that Vagrant sees.
`VAGRANT_DOTFILE_PATH` can be set to change the directory where Vagrant stores VM-specific state, such as the VirtualBox VM UUID. By default, this is set to `.vagrant`. If you keep your Vagrantfile in a Dropbox folder in order to share the folder between your desktop and laptop (for example), Vagrant will overwrite the files in this directory with the details of the VM on the most recently-used host. To avoid this, you could set `VAGRANT_DOTFILE_PATH` to `.vagrant-laptop` and `.vagrant-desktop` on the respective machines. (Remember to update your `.gitignore`!)
Non-absolute paths in this environmental variable are interpreted as relative to the Vagrantfile's location.
## `VAGRANT_HOME`
`VAGRANT_HOME` can be set to change the directory where Vagrant stores