Properly expand cygwin paths to Windows path for vboxmanage
This commit is contained in:
parent
96ebd3e8f7
commit
373a1d8633
|
@ -53,6 +53,7 @@ BUG FIXES:
|
||||||
- Cygwin will always output color by default. Specify `--no-color` to
|
- Cygwin will always output color by default. Specify `--no-color` to
|
||||||
override this.
|
override this.
|
||||||
- Assume Cygwin has a TTY for asking for input. [GH-1430]
|
- Assume Cygwin has a TTY for asking for input. [GH-1430]
|
||||||
|
- Expand Cygwin paths to Windows paths for calls to VBoxManage.
|
||||||
|
|
||||||
## 1.1.6 (April 3, 2013)
|
## 1.1.6 (April 3, 2013)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
require 'rbconfig'
|
require 'rbconfig'
|
||||||
require 'tempfile'
|
|
||||||
|
|
||||||
require "vagrant/util/subprocess"
|
require "vagrant/util/subprocess"
|
||||||
|
|
||||||
|
@ -8,14 +7,6 @@ module Vagrant
|
||||||
# This class just contains some platform checking code.
|
# This class just contains some platform checking code.
|
||||||
class Platform
|
class Platform
|
||||||
class << self
|
class << self
|
||||||
def tiger?
|
|
||||||
platform.include?("darwin8")
|
|
||||||
end
|
|
||||||
|
|
||||||
def leopard?
|
|
||||||
platform.include?("darwin9")
|
|
||||||
end
|
|
||||||
|
|
||||||
def cygwin?
|
def cygwin?
|
||||||
return true if ENV["VAGRANT_DETECTED_OS"] &&
|
return true if ENV["VAGRANT_DETECTED_OS"] &&
|
||||||
ENV["VAGRANT_DETECTED_OS"].downcase.include?("cygwin")
|
ENV["VAGRANT_DETECTED_OS"].downcase.include?("cygwin")
|
||||||
|
@ -37,32 +28,14 @@ module Vagrant
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns boolean noting whether this is a 64-bit CPU. This
|
# This takes any path and converts it to a full-length Windows
|
||||||
# is not 100% accurate and there could easily be false negatives.
|
# path on Windows machines in Cygwin.
|
||||||
#
|
#
|
||||||
# @return [Boolean]
|
|
||||||
def bit64?
|
|
||||||
["x86_64", "amd64"].include?(RbConfig::CONFIG["host_cpu"])
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns boolean noting whether this is a 32-bit CPU. This
|
|
||||||
# can easily throw false positives since it relies on {#bit64?}.
|
|
||||||
#
|
|
||||||
# @return [Boolean]
|
|
||||||
def bit32?
|
|
||||||
!bit64?
|
|
||||||
end
|
|
||||||
|
|
||||||
# This takes as input a path as a string and converts it into
|
|
||||||
# a platform-friendly version of the path. This is most important
|
|
||||||
# when using the path in shell environments with Cygwin.
|
|
||||||
#
|
|
||||||
# @param [String] path
|
|
||||||
# @return [String]
|
# @return [String]
|
||||||
def platform_path(path)
|
def cygwin_windows_path(path)
|
||||||
return path if !cygwin?
|
return path if !cygwin?
|
||||||
|
|
||||||
process = Subprocess.execute("cygpath", "-u", path.to_s)
|
process = Subprocess.execute("cygpath", "-w", "-l", "-a", path.to_s)
|
||||||
process.stdout.chomp
|
process.stdout.chomp
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -76,11 +49,6 @@ module Vagrant
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def tar_file_options
|
|
||||||
# create, write only, fail if the file exists, binary if windows
|
|
||||||
File::WRONLY | File::EXCL | File::CREAT | (windows? ? File::BINARY : 0)
|
|
||||||
end
|
|
||||||
|
|
||||||
def platform
|
def platform
|
||||||
RbConfig::CONFIG["host_os"].downcase
|
RbConfig::CONFIG["host_os"].downcase
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,7 +45,7 @@ module VagrantPlugins
|
||||||
# and break out
|
# and break out
|
||||||
vboxmanage = "#{path}VBoxManage.exe"
|
vboxmanage = "#{path}VBoxManage.exe"
|
||||||
if File.file?(vboxmanage)
|
if File.file?(vboxmanage)
|
||||||
@vboxmanage_path = Vagrant::Util::Platform.platform_path(vboxmanage)
|
@vboxmanage_path = Vagrant::Util::Platform.cygwin_windows_path(vboxmanage)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -159,7 +159,7 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def import(ovf)
|
def import(ovf)
|
||||||
ovf = Vagrant::Util::Platform.platform_path(ovf)
|
ovf = Vagrant::Util::Platform.cygwin_windows_path(ovf)
|
||||||
|
|
||||||
output = ""
|
output = ""
|
||||||
total = ""
|
total = ""
|
||||||
|
|
|
@ -159,7 +159,7 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def import(ovf)
|
def import(ovf)
|
||||||
ovf = Vagrant::Util::Platform.platform_path(ovf)
|
ovf = Vagrant::Util::Platform.cygwin_windows_path(ovf)
|
||||||
|
|
||||||
output = ""
|
output = ""
|
||||||
total = ""
|
total = ""
|
||||||
|
|
|
@ -157,7 +157,7 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def import(ovf)
|
def import(ovf)
|
||||||
ovf = Vagrant::Util::Platform.platform_path(ovf)
|
ovf = Vagrant::Util::Platform.cygwin_windows_path(ovf)
|
||||||
|
|
||||||
output = ""
|
output = ""
|
||||||
total = ""
|
total = ""
|
||||||
|
|
Loading…
Reference in New Issue