From 46cb0c514c17f40df1404845e944e34498817937 Mon Sep 17 00:00:00 2001 From: Marco Kellershoff Date: Sun, 13 Oct 2024 21:59:52 +0200 Subject: [PATCH] fix(fs): join_paths on windows --- lua/kulala/utils/fs.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lua/kulala/utils/fs.lua b/lua/kulala/utils/fs.lua index aa2d3fb..5e5ce4a 100644 --- a/lua/kulala/utils/fs.lua +++ b/lua/kulala/utils/fs.lua @@ -38,17 +38,13 @@ M.ps = M.get_path_separator() ---@return string M.join_paths = function(...) if M.get_os() == "windows" then - for i, v in ipairs({ ... }) do + for _, v in ipairs({ ... }) do -- if the path contains at least one forward slash, -- then it needs to be converted to backslashes if v:match("/") then local parts = {} - for j, p in ipairs({ ... }) do - if j == i then - table.insert(parts, p:sub(2):gsub("/", "\\")) - else - table.insert(parts, p:gsub("/", "\\")) - end + for _, p in ipairs({ ... }) do + table.insert(parts, p:gsub("/", "\\")) end return table.concat(parts, M.ps) end