From ebfb4a78b4bf879e56c0413f211737570567366e Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Thu, 27 Jul 2023 22:03:10 -0400 Subject: Normalized paths to backslashes. --- src/lpm.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lpm.lua b/src/lpm.lua index 6434a74..6fd5649 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -388,7 +388,7 @@ end function common.dirname(path) local s = path:reverse():find("[/\\]") if not s then return path end return path:sub(1, #path - s) end function common.basename(path) local s = path:reverse():find("[/\\]") if not s then return path end return path:sub(#path - s + 2) end function common.path(exec) return common.first(common.map({ common.split(":", os.getenv("PATH")) }, function(e) return e .. PATHSEP .. exec end), function(e) local s = system.stat(e) return s and s.type ~= "dir" and s.mode & 73 end) end -function common.normalize_path(path) if not path or not path:find("^~") then return path end return os.getenv("HOME") .. path:sub(2) end +function common.normalize_path(path) if PLATFORM == "Windows" and path then path = path:gsub("/", PATHSEP) end if not path or not path:find("^~") then return path end return os.getenv("HOME") .. path:sub(2) end function common.rmrf(root) local info = root and root ~= "" and system.stat(root) if not info then return end -- cgit v1.2.3