File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 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)
7070 return false
7171end
7272
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+
7390--- Get a path relative to another path.
7491--- @param path string
7592--- @param relative_to string | nil
@@ -80,8 +97,8 @@ function M.path_relative(path, relative_to)
8097 end
8198
8299 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 )
85102 end
86103
87104 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