don't trash files on different filesystems, and say it when it happens

This commit is contained in:
Lilian Jónsdóttir 2024-06-30 15:06:52 -07:00
parent 99a3bed240
commit 94864ff344

View file

@ -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
}