Skip to content

Commit

Permalink
use cfg freedesktop
Browse files Browse the repository at this point in the history
  • Loading branch information
TD-Sky committed Dec 22, 2024
1 parent 11ad0ff commit 1e3b2f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
22 changes: 8 additions & 14 deletions Cargo.lock

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

9 changes: 5 additions & 4 deletions src/handler/put.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ pub fn put(items: &[impl AsRef<Path>]) -> Result<()> {
return Err("Please specify the files to trash".into());
}

#[cfg(freedesktop)]
{
trash::delete_all(items)?;
}

#[cfg(target_os = "macos")]
{
use trash::{
Expand All @@ -19,10 +24,6 @@ pub fn put(items: &[impl AsRef<Path>]) -> Result<()> {
ctx.set_delete_method(DeleteMethod::NsFileManager);
ctx.delete_all(items)?;
}
#[cfg(all(not(target_os = "macos"), not(target_os = "android")))]
{
trash::delete_all(items)?;
}

Ok(())
}

0 comments on commit 1e3b2f9

Please sign in to comment.