Always expand to full path before converting to Windows path

This commit is contained in:
Chris Roberts 2018-06-18 09:07:12 -07:00
parent 3f23466703
commit 97eb459f56
1 changed files with 3 additions and 5 deletions

View File

@ -392,7 +392,7 @@ module Vagrant
# @param [String, Pathname] path Path to convert
# @return [String]
def wsl_to_windows_path(path)
path = path.to_s
path = File.expand_path(path.to_s)
if wsl? && wsl_windows_access? && !path.match(/^[a-zA-Z]:/)
if wsl_path?(path)
parts = path.split("/")
@ -403,17 +403,15 @@ module Vagrant
if root_path.end_with?("lxss") && !(["root", "home"].include?(parts.first))
root_path = "#{root_path}\\rootfs"
end
[root_path, *parts].join("\\")
path = [root_path, *parts].join("\\")
else
path = path.to_s.sub("/mnt/", "")
parts = path.split("/")
parts.first << ":"
path = parts.join("\\")
path
end
else
path
end
path
end
# Takes a windows path and formats it to the