small fixes

This commit is contained in:
Mylloon 2024-11-04 17:06:22 +01:00
parent c933f22b37
commit d33976f2e2
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -19,17 +19,17 @@ function trash --description "Move file or directory to the windows recycle bin.
set temp_dir (powershell.exe -Command "Write-Host \$env:TEMP") set temp_dir (powershell.exe -Command "Write-Host \$env:TEMP")
set path (wslpath -w $element) set path (wslpath -w $element)
# Move element to TEMP windows directory # Move element to temporary windows directory
cmd.exe /c "MKDIR $temp_dir 2>NUL" &> /dev/null cmd.exe /c "MKDIR $temp_dir 2>NUL" &> /dev/null
powershell.exe -Command "Copy-Item $path -Destination $temp_dir" powershell.exe -Command "Copy-Item \"$path\" -Destination \"$temp_dir\""
# Switch between trashing a file or a directory
set switch DeleteFile set switch DeleteFile
if test -d $element if test -d $element
set switch DeleteDirectory set switch DeleteDirectory
end end
# Move element to the Windows trash
# Move path to Windows trash
powershell.exe -Command "" \ powershell.exe -Command "" \
"Add-Type -AssemblyName Microsoft.VisualBasic;" \ "Add-Type -AssemblyName Microsoft.VisualBasic;" \
"[Microsoft.VisualBasic.FileIO.FileSystem]::$switch('$temp_dir\\$element', 'OnlyErrorDialogs', 'SendToRecycleBin')" "[Microsoft.VisualBasic.FileIO.FileSystem]::$switch('$temp_dir\\$element', 'OnlyErrorDialogs', 'SendToRecycleBin')"