mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
fix(explorer): differentiate if file or folder when deleting on Windows (#2373)
Some checks are pending
CI / ci (push) Waiting to run
Some checks are pending
CI / ci (push) Waiting to run
## Description Use different command on Windows for deleting folder/file to avoid error <!-- Describe the big picture of your changes to communicate to the maintainers why we should accept this pull request. --> ## Related Issue(s) Fixes #2371 <!-- If this PR fixes any issues, please link to the issue here. - Fixes #<issue_number> --> ## Screenshots <!-- Add screenshots of the changes if applicable. -->
This commit is contained in:
parent
3166af7ec3
commit
59c5545e91
1 changed files with 3 additions and 1 deletions
|
|
@ -25,7 +25,9 @@ function M.get_trash_cmds(path)
|
|||
"-Command",
|
||||
(
|
||||
"Add-Type -AssemblyName Microsoft.VisualBasic; "
|
||||
.. "[Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile('%s','OnlyErrorDialogs', 'SendToRecycleBin')"
|
||||
.. "[Microsoft.VisualBasic.FileIO.FileSystem]::"
|
||||
.. (vim.fn.isdirectory(path) == 0 and "DeleteFile" or "DeleteDirectory")
|
||||
.. "('%s','OnlyErrorDialogs', 'SendToRecycleBin')"
|
||||
):format(path:gsub("\\", "\\\\"):gsub("'", "''")),
|
||||
}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue