Skip to content

Commit

Permalink
fix: handle absolute paths on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-tdrn committed Jan 25, 2024
1 parent a999f1a commit 0aac080
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lua/flatten/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,14 @@ function M.edit_files(opts)
-- Open files
if nfiles > 0 then
for i, fname in ipairs(files) do
local is_absolute = string.find(fname, "^/")
local is_absolute = false

if vim.fn.has("win32") then
is_absolute = string.find(fname, "^%a:") ~= nil
else
is_absolute = string.find(fname, "^/") ~= nil
end

local fpath = is_absolute and fname or (guest_cwd .. "/" .. fname)
local file = {
fname = fpath,
Expand Down

0 comments on commit 0aac080

Please sign in to comment.