1
0
mirror of https://github.com/yorukot/superfile.git synced 2025-02-06 10:02:21 +00:00

fix: Used windows compatible library for trash in windows

This commit is contained in:
lazysegtree 2025-02-01 22:09:14 +05:30 committed by Nitin Kumar
parent 1d7f70571e
commit 2de2944dee
3 changed files with 10 additions and 0 deletions

1
go.mod
View File

@ -23,6 +23,7 @@ require (
github.com/alecthomas/chroma/v2 v2.14.0 // indirect
github.com/charmbracelet/x/ansi v0.4.5 // indirect
github.com/charmbracelet/x/term v0.2.1 // indirect
github.com/hymkor/trash-go v0.2.0 // indirect
)
require (

2
go.sum
View File

@ -117,6 +117,8 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/hymkor/trash-go v0.2.0 h1:t51zidKT8WuMTeeiMBsJxx+BDwnJtaaf/ckpjle2GOE=
github.com/hymkor/trash-go v0.2.0/go.mod h1:pZ07qBUuGdTWPdymNtE97NAXHDY5W/b5szvoBVOhJ3U=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=

View File

@ -9,6 +9,7 @@ import (
"strings"
"github.com/rkoesters/xdg/trash"
trash_win "github.com/hymkor/trash-go"
variable "github.com/yorukot/superfile/src/config"
"github.com/yorukot/superfile/src/config/icon"
)
@ -149,6 +150,12 @@ func trashMacOrLinux(src string) error {
outPutLog("Delete single item function move file to trash can error", err)
return err
}
} else if runtime.GOOS == "windows" {
err := trash_win.Throw(src)
if err != nil {
outPutLog("Delete single item function move file to trash can error", err)
return err
}
} else {
err := trash.Trash(src)
if err != nil {