From dacd37939e15547b00e28d37aeb3f0420966474e Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 13 Nov 2024 14:47:58 -0700 Subject: [PATCH] Let recursive copy or move determine what to do when crossing devices --- src/app.rs | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/src/app.rs b/src/app.rs index 82c095f..c3d341f 100644 --- a/src/app.rs +++ b/src/app.rs @@ -2305,34 +2305,10 @@ impl Application for App { }); } ClipboardKind::Cut => { - //TODO: determine ability to move on non-Unix systems - let mut can_move = true; - #[cfg(unix)] - { - use std::os::unix::fs::MetadataExt; - //TODO: better error handling, fall back to not moving? - if let Ok(to_meta) = fs::metadata(&to) { - for path in contents.paths.iter() { - if let Ok(meta) = fs::metadata(path) { - if meta.dev() != to_meta.dev() { - can_move = false; - } - } - } - } - } - - if can_move { - self.operation(Operation::Move { - paths: contents.paths, - to, - }); - } else { - self.operation(Operation::Copy { - paths: contents.paths, - to, - }); - } + self.operation(Operation::Move { + paths: contents.paths, + to, + }); } } }