From d24fe6d776913c3c9e0c5b0191a4e90cefeb8b9f Mon Sep 17 00:00:00 2001 From: Sergey Smirnykh Date: Sun, 13 Oct 2019 19:38:53 +0700 Subject: [PATCH] [Fix]: Use $XDG_DATA_HOME/graveyard instead of $XDG_DATA_HOME/tmp/graveyard --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index ffa7f3a..2a02389 100644 --- a/src/main.rs +++ b/src/main.rs @@ -95,7 +95,13 @@ Send files to the graveyard (/tmp/graveyard-$USER by default) instead of unlinki let _graveyard: Cow = match _graveyard_opts { (Some(flag), _, _) => flag.into(), (_, Ok(env), _) => env.into(), - (_, _, Ok(env)) => format!("{}{}", env, GRAVEYARD).into(), + (_, _, Ok(mut env)) => { + if !env.ends_with(std::path::MAIN_SEPARATOR) { + env.push(std::path::MAIN_SEPARATOR); + } + env.push_str("graveyard"); + env.into() + }, _ => format!("{}-{}", GRAVEYARD, get_user()).into(), }; let graveyard = Path::new(&*_graveyard);