Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhuster committed Nov 28, 2024
1 parent d546e6e commit fb71526
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lua/dirvish-do/operations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fb71526

Please sign in to comment.