Skip to content

Commit

Permalink
fix: Windows root path formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
basham00 authored and xixiaofinland committed Nov 15, 2024
1 parent 99462a5 commit 51ead9a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/sf/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ end
M.get_default_dir_path = function()
local dir_path = M.get_sf_root() .. vim.g.sf.default_dir
dir_path = dir_path:gsub("//", "/")
if dir_path:sub(1, 1) ~= "/" and dir_path:sub(1, 1) ~= "." then
if M.is_windows_os() then
dir_path = dir_path:gsub("\\", "/")
end
if dir_path:sub(1, 1) ~= "/" and dir_path:sub(1, 1) ~= "." and not M.is_windows_os() then
dir_path = "/" .. dir_path
end
if dir_path:sub(-1) ~= "/" then
Expand Down

0 comments on commit 51ead9a

Please sign in to comment.