From 94864ff3449241557feade4d6101ff005624e186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Sun, 30 Jun 2024 15:06:52 -0700 Subject: [PATCH] don't trash files on different filesystems, and say it when it happens --- internal/trash/trash.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/trash/trash.go b/internal/trash/trash.go index f2779d7..5b133c3 100644 --- a/internal/trash/trash.go +++ b/internal/trash/trash.go @@ -161,6 +161,9 @@ func TrashFile(trashDir, name string) error { // TODO: write across filesystems if err := os.Rename(name, out_path); err != nil { + if strings.Contains(err.Error(), "invalid cross-device link") { + return fmt.Errorf("not trashing file '%s': On different filesystem from trash directory", name) + } return err }