Skip to content

Commit

Permalink
fix darwin puts the file into the trash when click(enter) the file
Browse files Browse the repository at this point in the history
  • Loading branch information
yorukot committed Apr 22, 2024
1 parent 1b8f977 commit 6572739
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/normal_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ func enterPanel(m model) model {
}
} else if len(panel.element) > 0 && !panel.element[panel.cursor].directory {
if runtime.GOOS == "darwin" {
err := moveElement(panel.element[panel.cursor].location, HomeDir + "/.Trash/" + filepath.Base(panel.element[panel.cursor].location))
cmd := exec.Command("open", panel.element[panel.cursor].location)
_, err := cmd.Output()
if err != nil {
outPutLog("Delete single item function move file to trash can error", err)
outPutLog("err when open file with xdg-open:", err)
}
} else {
cmd := exec.Command("xdg-open", panel.element[panel.cursor].location)
Expand Down

0 comments on commit 6572739

Please sign in to comment.