diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index 3c0ecf420..9931c40f1 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -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