Skip to content

Commit

Permalink
update macos move file to trash can
Browse files Browse the repository at this point in the history
  • Loading branch information
yorukot committed Apr 17, 2024
1 parent 57f329b commit 5dfbcb9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/components/global_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package components

import (
"encoding/json"
"fmt"
"os"
"os/exec"
"path"
Expand Down Expand Up @@ -350,7 +349,7 @@ func pasteItem(m model) model {
if m.copyItems.cut {
for _, item := range m.copyItems.items {
if runtime.GOOS == "darwin" {
cmd := exec.Command("osascript", "-e", fmt.Sprintf("tell application \"Finder\" to delete POSIX file \"%s\"", item))
cmd := exec.Command("mv", "-fv", item, "~/.Trash/")
err := cmd.Run()
if err != nil {
outPutLog("Paste item function move file to trash can error", err)
Expand Down
3 changes: 1 addition & 2 deletions src/components/normal_controller.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package components

import (
"fmt"
"os"
"os/exec"
"path"
Expand Down Expand Up @@ -167,7 +166,7 @@ func deleteSingleItem(m model) model {
}
var err error
if runtime.GOOS == "darwin" {
cmd := exec.Command("osascript", "-e", fmt.Sprintf("tell application \"Finder\" to delete POSIX file \"%s\"", panel.element[panel.cursor].location))
cmd := exec.Command("mv", "-fv", panel.element[panel.cursor].location, "~/.Trash/")
err = cmd.Run()
if err != nil {
outPutLog("Delete single item function move file to trash can error", err)
Expand Down
3 changes: 1 addition & 2 deletions src/components/select_controller.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package components

import (
"fmt"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -191,7 +190,7 @@ func deleteMultipleItem(m model) model {
}
var err error
if runtime.GOOS == "darwin" {
cmd := exec.Command("osascript", "-e", fmt.Sprintf("tell application \"Finder\" to delete POSIX file \"%s\"", filePath))
cmd := exec.Command("mv", "-fv", filePath, "~/.Trash/")
err = cmd.Run()
if err != nil {
outPutLog("Delete single item function move file to trash can error", err)
Expand Down

0 comments on commit 5dfbcb9

Please sign in to comment.