From 6d2f69b612a363be73f47d7cd3c5272e20897fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E9=9B=85=20=C2=B7=20Misaki=20Masa?= Date: Tue, 19 Sep 2023 08:54:31 +0800 Subject: [PATCH] feat: make `trash` optional (#178) --- core/Cargo.toml | 4 +++- core/src/tasks/workers/file.rs | 2 +- shared/src/fs.rs | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/Cargo.toml b/core/Cargo.toml index a29d996a..6b459940 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -26,9 +26,11 @@ syntect = "^5" tokio = { version = "^1", features = [ "parking_lot", "macros", "rt-multi-thread", "sync", "time", "fs", "process", "io-std", "io-util" ] } tokio-stream = "^0" tracing = "^0" -trash = "^3" unicode-width = "^0" yazi-prebuild = "^0" [target.'cfg(target_os = "windows")'.dependencies] clipboard-win = "^4" + +[target.'cfg(not(target_os = "netbsd"))'.dependencies] +trash = "^3" diff --git a/core/src/tasks/workers/file.rs b/core/src/tasks/workers/file.rs index c55258a6..52d8f77d 100644 --- a/core/src/tasks/workers/file.rs +++ b/core/src/tasks/workers/file.rs @@ -159,7 +159,7 @@ impl File { ctx.set_delete_method(DeleteMethod::NsFileManager); ctx.delete(&task.target)?; } - #[cfg(not(target_os = "macos"))] + #[cfg(not(target_os = "netbsd"))] { trash::delete(&task.target)?; } diff --git a/shared/src/fs.rs b/shared/src/fs.rs index 2236dbc2..04801be6 100644 --- a/shared/src/fs.rs +++ b/shared/src/fs.rs @@ -101,6 +101,8 @@ pub fn file_mode(mode: u32) -> String { let m = mode as u16; #[cfg(target_os = "freebsd")] let m = mode as u16; + #[cfg(target_os = "netbsd")] + let m = mode; #[cfg(target_os = "linux")] let m = mode;