Use VBOX_INSTALL_PATH on Windows to find VBoxManage [GH-609]

This commit is contained in:
Mitchell Hashimoto 2012-01-05 23:12:17 -08:00
parent 8a0e81276e
commit 467542ef8d
1 changed files with 17 additions and 1 deletions

View File

@ -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