Always expand to full path before converting to Windows path
This commit is contained in:
parent
3f23466703
commit
97eb459f56
|
@ -392,7 +392,7 @@ module Vagrant
|
||||||
# @param [String, Pathname] path Path to convert
|
# @param [String, Pathname] path Path to convert
|
||||||
# @return [String]
|
# @return [String]
|
||||||
def wsl_to_windows_path(path)
|
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? && wsl_windows_access? && !path.match(/^[a-zA-Z]:/)
|
||||||
if wsl_path?(path)
|
if wsl_path?(path)
|
||||||
parts = path.split("/")
|
parts = path.split("/")
|
||||||
|
@ -403,17 +403,15 @@ module Vagrant
|
||||||
if root_path.end_with?("lxss") && !(["root", "home"].include?(parts.first))
|
if root_path.end_with?("lxss") && !(["root", "home"].include?(parts.first))
|
||||||
root_path = "#{root_path}\\rootfs"
|
root_path = "#{root_path}\\rootfs"
|
||||||
end
|
end
|
||||||
[root_path, *parts].join("\\")
|
path = [root_path, *parts].join("\\")
|
||||||
else
|
else
|
||||||
path = path.to_s.sub("/mnt/", "")
|
path = path.to_s.sub("/mnt/", "")
|
||||||
parts = path.split("/")
|
parts = path.split("/")
|
||||||
parts.first << ":"
|
parts.first << ":"
|
||||||
path = parts.join("\\")
|
path = parts.join("\\")
|
||||||
path
|
|
||||||
end
|
end
|
||||||
else
|
|
||||||
path
|
|
||||||
end
|
end
|
||||||
|
path
|
||||||
end
|
end
|
||||||
|
|
||||||
# Takes a windows path and formats it to the
|
# Takes a windows path and formats it to the
|
||||||
|
|
Loading…
Reference in New Issue