From 2e5a65552158c4d9694085177eb6236ca1c71cd0 Mon Sep 17 00:00:00 2001 From: zawedcvg Date: Tue, 8 Sep 2026 00:13:29 -0700 Subject: [PATCH] possibly fix the issue with create files? --- lua/opencode/events/permissions/edits.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/opencode/events/permissions/edits.lua b/lua/opencode/events/permissions/edits.lua index f1d8117b..2ea5a181 100644 --- a/lua/opencode/events/permissions/edits.lua +++ b/lua/opencode/events/permissions/edits.lua @@ -21,16 +21,16 @@ function M.diff(event) -- Opencode sends the absolute path sometimes with the HOME and sometimes without -- It has something to do with the path of the opencode server cwd wrt the file/directory - if vim.fn.filereadable(absolute_filepath) == 1 then + if vim.fn.isdirectory(vim.fs.dirname(absolute_filepath)) == 1 then filepath = absolute_filepath elseif vim.env.HOME and vim.env.HOME ~= "" then local home_filepath = vim.fs.normalize(vim.fs.joinpath(vim.env.HOME, filepath)) - if vim.fn.filereadable(home_filepath) == 1 then + if vim.fn.isdirectory(vim.fs.dirname(home_filepath)) == 1 then filepath = home_filepath end end - if vim.fn.filereadable(filepath) ~= 1 then + if vim.fn.isdirectory(vim.fs.dirname(filepath)) ~= 1 then return Promise.reject("Cannot resolve OpenCode edit target file: " .. filepath) end