fix: relative path (#2023)

This commit is contained in:
yetone
2025-05-09 19:57:25 +08:00
committed by GitHub
parent 56576c2481
commit 8f96d4319d
6 changed files with 40 additions and 23 deletions

View File

@@ -13,9 +13,8 @@ M.confirm_popup = nil
---@param rel_path string
---@return string
function M.get_abs_path(rel_path)
if Path:new(rel_path):is_absolute() then return rel_path end
local project_root = Utils.get_project_root()
local p = tostring(Path:new(project_root):joinpath(rel_path):absolute())
local p = Utils.join_paths(project_root, rel_path)
if p:sub(-2) == "/." then p = p:sub(1, -3) end
return p
end