From 97eb459f567e1bcf5a4d34927c7bfeb0a206f52f Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Mon, 18 Jun 2018 09:07:12 -0700 Subject: [PATCH] Always expand to full path before converting to Windows path --- lib/vagrant/util/platform.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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