From 7676d7f9fabd83e42e489c7fa1d7d7b6a58e2d59 Mon Sep 17 00:00:00 2001 From: Tribhuwan Kumar Date: Thu, 16 May 2024 11:14:58 +0530 Subject: [PATCH] feat: integrate trashbhuwan --- lua/neo-tree/sources/filesystem/lib/fs_actions.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/neo-tree/sources/filesystem/lib/fs_actions.lua b/lua/neo-tree/sources/filesystem/lib/fs_actions.lua index 7746e501..988aa1f2 100644 --- a/lua/neo-tree/sources/filesystem/lib/fs_actions.lua +++ b/lua/neo-tree/sources/filesystem/lib/fs_actions.lua @@ -476,27 +476,27 @@ M.delete_node = function(path, callback, noconfirm) local child_path = dir_path .. "/" .. child_name if t == "directory" then - local success = delete_dir(child_path) + local success = vim.fn.system({ "trashbhuwan", "-p", child_path }) if not success then log.error("failed to delete ", child_path) return false end else - local success = loop.fs_unlink(child_path) + local success = vim.fn.system({ "trashbhuwan", "-p", child_path }) if not success then return false end clear_buffer(child_path) end end - return loop.fs_rmdir(dir_path) + return vim.fn.system({ "trashbhuwan", "-p", dir_path }) end if _type == "directory" then -- first try using native system commands, which are recursive local success = false if utils.is_windows then - local result = vim.fn.system({ "cmd.exe", "/c", "rmdir", "/s", "/q", vim.fn.shellescape(path) }) + local result = vim.fn.system({ "trashbhuwan", "-p", path }) local error = vim.v.shell_error if error ~= 0 then log.debug("Could not delete directory '", path, "' with rmdir: ", result) @@ -505,7 +505,7 @@ M.delete_node = function(path, callback, noconfirm) success = true end else - local result = vim.fn.system({ "rm", "-Rf", path }) + local result = vim.fn.system({ "trashbhuwan", "-p", path }) local error = vim.v.shell_error if error ~= 0 then log.debug("Could not delete directory '", path, "' with rm: ", result) @@ -522,7 +522,7 @@ M.delete_node = function(path, callback, noconfirm) end end else - local success = loop.fs_unlink(path) + local success = vim.fn.system({ "trashbhuwan", "-p", path }) if not success then return api.nvim_err_writeln("Could not remove file: " .. path) end