Skip to content

Commit

Permalink
Fix: display right error message on non-extfs errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementNerma committed Aug 7, 2020
1 parent fbb29e9 commit 34c6455
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "trasher"
version = "1.3.2"
version = "1.3.3"
authors = ["Clément Nerma <clement.nerma@gmail.com>"]
edition = "2018"
license = "Apache-2.0"
Expand Down
7 changes: 6 additions & 1 deletion src/actions.rs
Original file line number Diff line number Diff line change
@@ -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::*;
Expand Down Expand Up @@ -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.");
Expand Down

0 comments on commit 34c6455

Please sign in to comment.