From ccf99d8c0cecc50438b9e5c61e8052d55f6fc871 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 6 Sep 2019 13:37:38 -0700 Subject: [PATCH] Fixes #11022: Show proper path & letter drive on exceptions for windows Prior to this commit, vagrant was not grabbing all of the tokens on Windows for showing the full drive because the ruby api for it behaves differenly on windows compared to other platforms. This commit changes that by ensuring the letter drive is attached to the path when showing an exception. --- lib/vagrant/config/loader.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/config/loader.rb b/lib/vagrant/config/loader.rb index 64d4f404a..2c7e8b22e 100644 --- a/lib/vagrant/config/loader.rb +++ b/lib/vagrant/config/loader.rb @@ -2,6 +2,8 @@ require "pathname" require "log4r" +require "vagrant/util/platform" + module Vagrant module Config # This class is responsible for loading Vagrant configuration, @@ -129,7 +131,13 @@ module Vagrant path = "(unknown)" if e.backtrace && e.backtrace[0] backtrace_tokens = e.backtrace[0].split(":") - path = backtrace_tokens[0] + if Vagrant::Util::Platform.windows? + # path is split into two tokens on windows for some reason... + # where 0th is drive letter, 1st is path + path = backtrace_tokens[0] + ":" + backtrace_tokens[1] + else + path = backtrace_tokens[0] + end backtrace_tokens.each do |part| if part =~ /\d+/ line = part.to_i