aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-core/path.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/mason-core/path.lua')
-rw-r--r--lua/mason-core/path.lua19
1 files changed, 2 insertions, 17 deletions
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