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.
This commit is contained in:
Brian Cain 2019-09-06 13:37:38 -07:00
parent b28e6d95a6
commit ccf99d8c0c
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
1 changed files with 9 additions and 1 deletions

View File

@ -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