From 80944cbf22e10a4debe59d2f0166fb0cd7b1b1aa Mon Sep 17 00:00:00 2001 From: William Boman Date: Fri, 13 Oct 2023 17:05:12 +0200 Subject: feat(linker): use relative targets for symlinks (#1525) Closes #1156. --- lua/mason-core/path.lua | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'lua/mason-core/path.lua') diff --git a/lua/mason-core/path.lua b/lua/mason-core/path.lua index 66f0f964..eec3148d 100644 --- a/lua/mason-core/path.lua +++ b/lua/mason-core/path.lua @@ -1,24 +1,9 @@ -local sep = (function() - ---@diagnostic disable-next-line: undefined-global - if jit then - ---@diagnostic disable-next-line: undefined-global - local os = string.lower(jit.os) - if os == "linux" or os == "osx" or os == "bsd" then - return "/" - else - return "\\" - end - else - return string.sub(package.config, 1, 1) - end -end)() - local M = {} ---@param path_components string[] ---@return string function M.concat(path_components) - return table.concat(path_components, sep) + return vim.fs.normalize(table.concat(path_components, "/")) end ---@path root_path string @@ -55,7 +40,7 @@ function M.relative(from, to) local common_parent, distance = find_closest_common_parent(from_normalized, to_normalized) local relative_path_component = distance == 0 and "." or (".."):rep(distance, "/") - return vim.fs.joinpath(relative_path_component, to_normalized:sub(#common_parent + 1)) + return M.concat { relative_path_component, to_normalized:sub(#common_parent + 1) } end return M -- cgit v1.2.3-70-g09d2