diff --git a/lib/vagrant/driver/virtualbox.rb b/lib/vagrant/driver/virtualbox.rb index b658edd16..570955757 100644 --- a/lib/vagrant/driver/virtualbox.rb +++ b/lib/vagrant/driver/virtualbox.rb @@ -1,5 +1,6 @@ require 'log4r' require 'vagrant/util/busy' +require 'vagrant/util/platform' require 'vagrant/util/subprocess' module Vagrant @@ -26,6 +27,21 @@ module Vagrant # This flag is used to keep track of interrupted state (SIGINT) @interrupted = false + # Set the path to VBoxManage + @vboxmanage_path = "VBoxManage" + + if Util::Platform.windows? + @logger.debug("Windows. Trying VBOX_INSTALL_PATH for VBoxManage") + + # On Windows, we use the VBOX_INSTALL_PATH environmental + # variable to find VBoxManage. + if ENV.has_key?("VBOX_INSTALL_PATH") + @vboxmanage_path = "#{ENV["VBOX_INSTALL_PATH"]}\VBoxManage.exe" + end + end + + @logger.info("VBoxManage path: #{@vboxmanage_path}") + if @uuid # Verify the VM exists, and if it doesn't, then don't worry # about it (mark the UUID as nil) @@ -481,7 +497,7 @@ module Vagrant end Util::Busy.busy(int_callback) do - Subprocess.execute("VBoxManage", *command, &block) + Subprocess.execute(@vboxmanage_path, *command, &block) end end end