From 4f72f663a69c0a9a72dba36c3fe082b31de32db3 Mon Sep 17 00:00:00 2001 From: xiaojianzheng <1272209235@qq.com> Date: Wed, 28 Aug 2024 09:40:14 +0800 Subject: [PATCH] fix(cache): can not mkdir multilevel folder --- lua/curl/cache.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/curl/cache.lua b/lua/curl/cache.lua index 82e96d2..dcefe9d 100644 --- a/lua/curl/cache.lua +++ b/lua/curl/cache.lua @@ -1,5 +1,6 @@ local M = {} local Path = require("plenary.path") +local notify = require("curl.notifications") ---comment ---@param global boolean @@ -21,7 +22,10 @@ local curl_cache_dir = function(custom_dir) cache_dir = cache_dir / custom_dir ---@type Path end - cache_dir:mkdir({ parents = true, exists_ok = true }) + if vim.fn.mkdir(cache_dir:absolute(), "p") ~= 1 then + notify.error("Error creating collection: could not create directory : " .. cache_dir:absolute()) + end + return cache_dir end