fix(explorer): differentiate if file or folder when deleting on Windows (#2373)
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:
Iordanis Petkakis 2025-10-28 22:18:04 +02:00 committed by GitHub
parent 3166af7ec3
commit 59c5545e91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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