Convert Windows paths in volumes if detected

This commit is contained in:
Chris Roberts 2017-05-12 15:11:10 -07:00
parent 36ecd40c52
commit 27ca3ef831
1 changed files with 13 additions and 1 deletions

View File

@ -85,7 +85,19 @@ module VagrantPlugins
image = params.fetch(:image)
links = params.fetch(:links)
ports = Array(params[:ports])
volumes = Array(params[:volumes])
volumes = Array(params[:volumes]).map do |v|
v = v.to_s
if v.include?(":") && (Vagrant::Util::Platform.windows? || Vagrant::Util::Platform.wsl?)
host, guest = v.split(":", 2)
host = Vagrant::Util::Platform.windows_path(host)
# NOTE: Docker does not support UNC style paths (which also
# means that there's no long path support). Hopefully this
# will be fixed someday and the gsub below can be removed.
host.gsub!(/^[^A-Za-z]+/, "")
v = [host, guest].join(":")
end
v
end
cmd = Array(params.fetch(:cmd))
env = Hash[*params.fetch(:env).flatten.map(&:to_s)]
expose = Array(params[:expose])