diff --git a/lua/core/init.lua b/lua/core/init.lua index 6a49d0da0..59dbf37d7 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -3,7 +3,7 @@ local global = require("core.global") -- Create cache dir and data dirs local createdir = function() - local data_dir = { + local data_dirs = { global.cache_dir .. "backup", global.cache_dir .. "session", global.cache_dir .. "swap", @@ -12,10 +12,11 @@ local createdir = function() } -- Only check whether cache_dir exists, this would be enough. if vim.fn.isdirectory(global.cache_dir) == 0 then - os.execute("mkdir -p " .. global.cache_dir) - for _, v in pairs(data_dir) do - if vim.fn.isdirectory(v) == 0 then - os.execute("mkdir -p " .. v) + ---@diagnostic disable-next-line: param-type-mismatch + vim.fn.mkdir(global.cache_dir, "p") + for _, dir in pairs(data_dirs) do + if vim.fn.isdirectory(dir) == 0 then + vim.fn.mkdir(dir, "p") end end end