diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index a55c4f61c..c3b16d083 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -14,6 +14,10 @@ module Vagrant platform.include?("darwin9") end + def cygwin? + platform.include?("cygwin") + end + [:darwin, :bsd, :freebsd, :linux, :solaris].each do |type| define_method("#{type}?") do platform.include?(type.to_s) diff --git a/plugins/providers/virtualbox/action/import.rb b/plugins/providers/virtualbox/action/import.rb index 14ac2b0bb..0dfd52f89 100644 --- a/plugins/providers/virtualbox/action/import.rb +++ b/plugins/providers/virtualbox/action/import.rb @@ -12,6 +12,9 @@ module VagrantPlugins # Import the virtual machine ovf_file = env[:machine].box.directory.join("box.ovf").to_s + if Vagrant::Util::Platform.cygwin? + ovf_file = `cygpath -m '#{ovf_file}'`.chomp + end env[:machine].id = env[:machine].provider.driver.import(ovf_file) do |progress| env[:ui].clear_line env[:ui].report_progress(progress, 100, false) diff --git a/plugins/providers/virtualbox/driver/base.rb b/plugins/providers/virtualbox/driver/base.rb index 5dfb23aa5..e7cc2e035 100644 --- a/plugins/providers/virtualbox/driver/base.rb +++ b/plugins/providers/virtualbox/driver/base.rb @@ -25,7 +25,7 @@ module VagrantPlugins # Set the path to VBoxManage @vboxmanage_path = "VBoxManage" - if Vagrant::Util::Platform.windows? + if Vagrant::Util::Platform.windows? || Vagrant::Util::Platform.cygwin? @logger.debug("Windows. Trying VBOX_INSTALL_PATH for VBoxManage") # On Windows, we use the VBOX_INSTALL_PATH environmental @@ -33,6 +33,9 @@ module VagrantPlugins if ENV.has_key?("VBOX_INSTALL_PATH") # Get the path. path = ENV["VBOX_INSTALL_PATH"] + if Vagrant::Util::Platform.cygwin? + path = `cygpath -u '#{path}'`.chomp + end @logger.debug("VBOX_INSTALL_PATH value: #{path}") # There can actually be multiple paths in here, so we need to