Skip to content

Commit 535ebb5

Browse files
committed
fix: use vim built-in mkdir to create the directory
1 parent 996194e commit 535ebb5

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

lua/copilot/lsp_binary.lua

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,9 @@ local M = {
1414
}
1515

1616
local function ensure_directory_exists(path)
17-
local dir_path = path
18-
local cmd
19-
20-
if dir_path and vim.fn.isdirectory(dir_path) == 0 then
21-
if vim.fn.has("win32") > 0 then
22-
cmd = 'cmd /c "mkdir "' .. dir_path:gsub("\\", "\\\\"):gsub("/", "\\\\")
23-
else
24-
cmd = "mkdir " .. vim.fn.shellescape(dir_path)
25-
end
26-
27-
logger.trace("Creating directory with command: " .. cmd)
28-
vim.fn.system(cmd)
29-
30-
if vim.v.shell_error ~= 0 then
31-
logger.error("Failed to create directory: " .. dir_path)
17+
if path and vim.fn.isdirectory(path) == 0 then
18+
if vim.fn.mkdir(path) == 0 then
19+
logger.error("failed to create directory: " .. path)
3220
return false
3321
end
3422
end

0 commit comments

Comments
 (0)