fix(util): fixed double slashes

This commit is contained in:
Folke Lemaitre 2022-12-20 08:47:01 +01:00
parent 62c1542141
commit af87108605
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -29,7 +29,11 @@ end
function M.norm(path)
if path:sub(1, 1) == "~" then
path = vim.loop.os_homedir() .. "/" .. path:sub(2)
local home = vim.loop.os_homedir()
if home:sub(-1) == "\\" or home:sub(-1) == "/" then
home = home:sub(1, -2)
end
path = home .. path:sub(2)
end
return path:gsub("\\", "/")
end