From 9e2ebab2f79d01a15da85940cd54a4df85f340ce Mon Sep 17 00:00:00 2001 From: Theo Beers <32523293+theodore-s-beers@users.noreply.github.com> Date: Sat, 24 Feb 2024 13:01:26 +0100 Subject: [PATCH] Invert conditional --- src/main.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3d9c32d..a99c09c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -83,13 +83,13 @@ fn main() -> Result<(), anyhow::Error> { // If we have clear-cache flag, handle it and return if clear_cache { - if cache_dir.exists() { - trash::delete(cache_dir)?; - eprintln!("Cache directory deleted"); - return Ok(()); + if !cache_dir.exists() { + return Err(anyhow!("Cache directory not found")); } - return Err(anyhow!("Cache directory not found")); + trash::delete(cache_dir)?; + eprintln!("Cache directory deleted"); + return Ok(()); } // If we don't have the cache dir yet, try to create it