Skip to content

Commit c82264a

Browse files
author
John Mutuma (from Dev Box)
committed
fix(context): normalize file paths for Windows compatibility
1 parent 7c20424 commit c82264a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lua/sidekick/cli/context/location.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ function M.get(ctx, opts)
1919
opts.kind = opts.kind or "position"
2020
assert(ctx.buf or ctx.name, "Either buf or name must be provided")
2121

22-
local name = ctx.name or vim.api.nvim_buf_get_name(ctx.buf)
22+
local name = vim.fs.normalize(ctx.name or vim.api.nvim_buf_get_name(ctx.buf))
2323
if not name or name == "" then
2424
name = "[No Name]"
2525
else
26-
local cwd = ctx.cwd or vim.fn.getcwd(0)
26+
local cwd = ctx.cwd or vim.fs.normalize(vim.fn.getcwd(0))
2727
local ok, rel = pcall(vim.fs.relpath, cwd, name)
2828
if ok and rel and rel ~= "" and rel ~= "." then
29-
name = rel
29+
name = rel:gsub("\\", "/")
3030
end
3131
end
3232

0 commit comments

Comments
 (0)