summaryrefslogtreecommitdiff
path: root/lua/99/request-context.lua
diff options
context:
space:
mode:
authorChristoffer Winterkvist <christoffer@winterkvist.com>2026-02-08 00:28:22 +0100
committertheprimeagain <the.primeagen@gmail.com>2026-02-08 09:41:21 -0700
commit461bd8fbcbcb2d44fa6eb5f2ec9c7adf678179bd (patch)
tree0da788a026d96f0688deb031e06d611331148f09 /lua/99/request-context.lua
parent7717b2d00f0dfc0e8dc03a938761de1cc7fc215d (diff)
downloada4-461bd8fbcbcb2d44fa6eb5f2ec9c7adf678179bd.tar.xz
a4-461bd8fbcbcb2d44fa6eb5f2ec9c7adf678179bd.zip
Wrap vim.uv.fs_mkdir in a pcall and check that the directory exists before calling it
Diffstat (limited to 'lua/99/request-context.lua')
-rw-r--r--lua/99/request-context.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/lua/99/request-context.lua b/lua/99/request-context.lua
index 0b0870e..f0db52f 100644
--- a/lua/99/request-context.lua
+++ b/lua/99/request-context.lua
@@ -129,7 +129,10 @@ function RequestContext:save_prompt(prompt)
local prompt_file = self.tmp_file .. "-prompt"
local dir = vim.fs.dirname(prompt_file)
- vim.fn.mkdir(dir, "p")
+
+ if dir and not vim.uv.fs_stat(dir) then
+ pcall(vim.uv.fs_mkdir, dir, 493)
+ end
local file = io.open(prompt_file, "w")
if file then