From fb71526e5c612d476f4f2dae989dbd62b4b7a090 Mon Sep 17 00:00:00 2001 From: brianhuster Date: Thu, 28 Nov 2024 22:41:11 +0700 Subject: [PATCH] update --- lua/dirvish-do/operations.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lua/dirvish-do/operations.lua b/lua/dirvish-do/operations.lua index e7e655d..a1411c2 100644 --- a/lua/dirvish-do/operations.lua +++ b/lua/dirvish-do/operations.lua @@ -14,18 +14,22 @@ function M.rm(path) M.trash(path) return end - local isDir = path:sub(-1) == "/" - if isDir then - if fs.rm then + local isDir = path:sub(-1) == M.sep + if fs.rm then + if isDir then fs.rm(path, { recursive = true }) else - fn.delete(path, 'rf') + fs.rm(path) end else - if fs.rm then - fs.rm(path) + local fail + if isDir then + fail = fn.delete(path, 'rf') else - fn.delete(path) + fail = fn.delete(path) + end + if fail ~= 0 then + vim.notify(string.format("Failed to delete %s", path), vim.log.levels.ERROR) end end end