This commit is contained in:
sxyazi 2023-09-19 00:24:01 +08:00
parent 2447917ac7
commit e8d7716df3
No known key found for this signature in database
2 changed files with 11 additions and 16 deletions

View file

@ -26,13 +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 = { version = "^3", optional = true }
unicode-width = "^0"
yazi-prebuild = "^0"
[target.'cfg(target_os = "windows")'.dependencies]
clipboard-win = "^4"
[features]
trash_bin = [ "trash" ]
default = [ "trash_bin" ]
[target.'cfg(not(target_os = "netbsd"))'.dependencies]
trash = "^3"

View file

@ -152,19 +152,16 @@ impl File {
self.sch.send(TaskOp::Adv(task.id, 1, task.length))?
}
FileOp::Trash(task) => {
#[cfg(feature = "trash_bin")]
#[cfg(target_os = "macos")]
{
#[cfg(target_os = "macos")]
{
use trash::{macos::{DeleteMethod, TrashContextExtMacos}, TrashContext};
let mut ctx = TrashContext::default();
ctx.set_delete_method(DeleteMethod::NsFileManager);
ctx.delete(&task.target)?;
}
#[cfg(not(target_os = "macos"))]
{
trash::delete(&task.target)?;
}
use trash::{macos::{DeleteMethod, TrashContextExtMacos}, TrashContext};
let mut ctx = TrashContext::default();
ctx.set_delete_method(DeleteMethod::NsFileManager);
ctx.delete(&task.target)?;
}
#[cfg(not(target_os = "netbsd"))]
{
trash::delete(&task.target)?;
}
self.sch.send(TaskOp::Adv(task.id, 1, task.length))?;
}