From 34c6455289f289cb0dfc5c76bd5d8e4fb6cddca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Nerma?= Date: Sat, 8 Aug 2020 00:36:41 +0200 Subject: [PATCH] Fix: display right error message on non-extfs errors --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/actions.rs | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c12c64..ac21914 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -371,7 +371,7 @@ dependencies = [ [[package]] name = "trasher" -version = "1.3.2" +version = "1.3.3" dependencies = [ "base64", "chrono", diff --git a/Cargo.toml b/Cargo.toml index f22b3a2..3597cf9 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "trasher" -version = "1.3.2" +version = "1.3.3" authors = ["Clément Nerma "] edition = "2018" license = "Apache-2.0" diff --git a/src/actions.rs b/src/actions.rs index 251dc6f..ba1ca16 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -1,5 +1,6 @@ use std::fs; use std::path::PathBuf; +use std::io::ErrorKind; use super::{debug, fail}; use super::command::*; use super::items::*; @@ -105,8 +106,12 @@ pub fn remove(action: &MoveToTrash) { if let Err(err) = fs::rename(&path, &trash_item_path) { debug!("Renaming failed: {:?}", err); + if err.kind() != ErrorKind::Other { + fail!("An error occured while trying to move item to trash: {}", err); + } + if !move_ext_filesystems { - fail!("Failed to move item to trash: {}", err); + fail!("Failed to move item to trash: {}\nHelp: Item may be located on another drive, try with '--move-ext-filesystems'.", err); } debug!("Falling back to copying.");