From 198963fdabdb24e530808542090c5de3f28ec808 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 20 Dec 2022 07:19:41 +0100 Subject: [PATCH] feat: utility method to normalize a path --- lua/lazy/core/util.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/lazy/core/util.lua b/lua/lazy/core/util.lua index 999c508..ce89952 100644 --- a/lua/lazy/core/util.lua +++ b/lua/lazy/core/util.lua @@ -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)