diff --git a/src/ops/put.rs b/src/ops/put.rs index 555a4bf..969022d 100644 --- a/src/ops/put.rs +++ b/src/ops/put.rs @@ -98,7 +98,7 @@ pub fn put(options: PutOptions) -> Result<()> { // println!("Strategy: {:?}", strategy); if options.dry { - eprintln!("Dry-deleting: {}", path.to_str().unwrap()); + eprintln!("Dry-deleting {:?} with strategy {:?}", path, strategy); } else if let Err(err) = strategy.delete(path, &options) { eprintln!("{}", err); } @@ -140,12 +140,19 @@ impl DeletionStrategy { } // try to use the $topdir/.Trash directory - if should_use_topdir_trash(&target_mount) { + // NOTE: really wish i could break from if statements... + 'topdir: while should_use_topdir_trash(&target_mount) { let topdir_trash_dir = target_mount .join(".Trash") .join(utils::get_uid().to_string()); - let trash_dir = TrashDir::from(topdir_trash_dir); - trash_dir.create()?; + let trash_dir = TrashDir::from(&topdir_trash_dir); + match trash_dir.create() { + Ok(_) => (), + Err(err) => { + info!("Not deleting {:?} in mount's trash-dir {:?} because of IO error: {:?}", target, topdir_trash_dir, err); + break 'topdir; + } + } return Ok(DeletionStrategy::MoveTo(trash_dir)); }