From 7c0f78f4d68f13ed2317c56df075f038ba87fc38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Tue, 30 Jul 2024 13:58:06 -0700 Subject: [PATCH] more consistent errors --- internal/files/trash.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/files/trash.go b/internal/files/trash.go index 31078f2..12e5d17 100644 --- a/internal/files/trash.go +++ b/internal/files/trash.go @@ -214,10 +214,11 @@ func ConfirmClean(confirm bool, fs Files) error { func TrashFile(trashDir, name string) error { trashinfoFilename, outPath := ensureUniqueName(filepath.Base(name), trashDir) - // TODO: write across filesystems if err := os.Rename(name, outPath); 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) + // TODO: use $topdir/.Trash as per XDG spec + // TODO: maybe figure out if filesystem is truly different or is a btrfs subvolume + return err } return err } @@ -239,7 +240,7 @@ func TrashFile(trashDir, name string) error { func TrashFiles(trashDir string, files ...string) (trashed int) { for _, file := range files { if err := TrashFile(trashDir, file); err != nil { - log.Errorf("error trashing file %s: %s", file, err) + log.Errorf("cannot trash '%s': %s", file, err) continue } trashed++