feat: utility method to normalize a path

This commit is contained in:
Folke Lemaitre 2022-12-20 07:19:41 +01:00
parent a18988372f
commit 198963fdab
No known key found for this signature in database
GPG Key ID: 36B7C1C85AAC487F
1 changed files with 7 additions and 0 deletions

View File

@ -27,6 +27,13 @@ function M.track(data, time)
end
end
function M.norm(path)
if path:sub(1, 1) == "~" then
path = vim.loop.os_homedir() .. "/" .. path:sub(2)
end
return path:gsub("\\", "/")
end
function M.try(fn, msg)
-- error handler
local error_handler = function(err)