From 7b36aa828b7f4337ab3583cf13f8ad89262df6af Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 22 Jun 2025 15:46:16 +0800 Subject: [PATCH] fix: create parent dir (#2296) --- lua/avante/llm_tools/replace_in_file.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/avante/llm_tools/replace_in_file.lua b/lua/avante/llm_tools/replace_in_file.lua index 9ea7c71..546c47d 100644 --- a/lua/avante/llm_tools/replace_in_file.lua +++ b/lua/avante/llm_tools/replace_in_file.lua @@ -737,7 +737,7 @@ function M.func(opts, on_log, on_complete, session_ctx) end local parent_dir = vim.fn.fnamemodify(abs_path, ":h") --- check if the parent dir is exists, if not, create it - if not vim.fn.isdirectory(parent_dir) then vim.fn.mkdir(parent_dir, "p") end + if vim.fn.isdirectory(parent_dir) == 0 then vim.fn.mkdir(parent_dir, "p") end vim.api.nvim_buf_call(bufnr, function() vim.cmd("noautocmd write") end) if session_ctx then Helpers.mark_as_not_viewed(opts.path, session_ctx) end on_complete(true, nil)