From 359ea23069bb58b503fe1923e0e885499a5d946b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 4 May 2012 20:48:52 -0700 Subject: [PATCH] Support multiple paths in VBOX_INSTALL_PATH [GH-885] --- CHANGELOG.md | 2 ++ lib/vagrant/driver/virtualbox_base.rb | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e2a9221f..8631d9776 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ - Fix issue where changing SSH key permissions didn't properly work. [GH-911] - Disable the NAT DNS proxy when the DNS server is already proxied to localhost on Linux machines. This fixes issues with 12.04. [GH-909] + - Fix issue where Vagrant didn't properly detect VBoxManage on Windows + if VBOX_INSTALL_PATH contained multiple paths. [GH-885] ## 1.0.3 (May 1, 2012) diff --git a/lib/vagrant/driver/virtualbox_base.rb b/lib/vagrant/driver/virtualbox_base.rb index 7edddbb45..ceff5d0b7 100644 --- a/lib/vagrant/driver/virtualbox_base.rb +++ b/lib/vagrant/driver/virtualbox_base.rb @@ -31,10 +31,24 @@ module Vagrant # On Windows, we use the VBOX_INSTALL_PATH environmental # variable to find VBoxManage. if ENV.has_key?("VBOX_INSTALL_PATH") - # The path usually ends with a \ but we make sure here + # Get the path. path = ENV["VBOX_INSTALL_PATH"] - path += "\\" if !path.end_with?("\\") - @vboxmanage_path = "#{path}VBoxManage.exe" + @logger.debug("VBOX_INSTALL_PATH value: #{path}") + + # There can actually be multiple paths in here, so we need to + # split by the separator ";" and see which is a good one. + path.split(";").each do |single| + # Make sure it ends with a \ + single += "\\" if !single.end_with?("\\") + + # If the executable exists, then set it as the main path + # and break out + vboxmanage = "#{path}VBoxManage.exe" + if File.file?(vboxmanage) + @vboxmanage_path = vboxmanage + break + end + end end end