File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,18 @@ local function has_parentheses_and_brackets(path)
70
70
return false
71
71
end
72
72
73
+ --- Path normalizations for windows only
74
+ local function win_norm_path (path )
75
+ local norm_path = path
76
+ -- Normalize for issue #2862 and #2961
77
+ if has_parentheses_and_brackets (norm_path ) then
78
+ norm_path = norm_path :gsub (" /" , " \\ " )
79
+ end
80
+ -- Normalize the drive letter
81
+ norm_path = string.upper (string.sub (norm_path , 1 , 1 )) .. string.sub (norm_path , 2 )
82
+ return norm_path
83
+ end
84
+
73
85
--- Get a path relative to another path.
74
86
--- @param path string
75
87
--- @param relative_to string | nil
@@ -80,8 +92,8 @@ function M.path_relative(path, relative_to)
80
92
end
81
93
82
94
local norm_path = path
83
- if M .is_windows and has_parentheses_and_brackets ( path ) then
84
- norm_path = path : gsub ( " / " , " \\ " )
95
+ if M .is_windows then
96
+ norm_path = win_norm_path ( norm_path )
85
97
end
86
98
87
99
local _ , r = norm_path :find (M .path_add_trailing (relative_to ), 1 , true )
You can’t perform that action at this time.
0 commit comments