Skip to content

Commit

Permalink
feat: utility method to normalize a path
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 20, 2022
1 parent a189883 commit 198963f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lua/lazy/core/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 198963f

Please sign in to comment.