File tree 1 file changed +19
-2
lines changed
1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,23 @@ 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
+ if path == nil then
76
+ return path
77
+ end
78
+ local norm_path = path
79
+ -- Normalize for issue #2862 and #2961
80
+ if has_parentheses_and_brackets (norm_path ) then
81
+ norm_path = norm_path :gsub (" /" , " \\ " )
82
+ end
83
+ -- Normalize the drive letter
84
+ norm_path = norm_path :gsub (" ^%l:" , function (drive )
85
+ return drive :upper ()
86
+ end )
87
+ return norm_path
88
+ end
89
+
73
90
--- Get a path relative to another path.
74
91
--- @param path string
75
92
--- @param relative_to string | nil
@@ -80,8 +97,8 @@ function M.path_relative(path, relative_to)
80
97
end
81
98
82
99
local norm_path = path
83
- if M .is_windows and has_parentheses_and_brackets ( path ) then
84
- norm_path = path : gsub ( " / " , " \\ " )
100
+ if M .is_windows then
101
+ norm_path = win_norm_path ( norm_path )
85
102
end
86
103
87
104
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