Do not use normalize_path when not needed

This commit is contained in:
Francesco Abbate
2021-10-21 23:18:31 +02:00
parent f472c24c73
commit 9c52c420c5
2 changed files with 24 additions and 6 deletions
+18
View File
@@ -280,6 +280,24 @@ local function split_on_slash(s, sep_pattern)
end
-- The filename argument given to the function is supposed to
-- come from system.absolute_path and as such should be an
-- absolute path without . or .. elements.
-- This function exists because on Windows the drive letter returned
-- by system.absolute_path is sometimes with a lower case and sometimes
-- with an upper case to we normalize to upper case.
function common.normalize_volume(filename)
if not filename then return end
if PATHSEP == '\\' then
local drive, rem = filename:match('^([a-zA-Z]:\\)(.*)')
if drive then
return drive:upper() .. rem
end
end
return filename
end
function common.normalize_path(filename)
if not filename then return end
local volume