From af4047a133360cbaddee5c4ba7029c6e1095e199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kornel=20Lesi=C5=84ski?= Date: Sat, 29 Aug 2020 17:40:49 +0100 Subject: [PATCH] Smarter handling of dest dir --- src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index f6753b7..6c9db04 100644 --- a/src/main.rs +++ b/src/main.rs @@ -71,9 +71,12 @@ fn run() -> Result<(), BoxError> { return Err("No PNG/JPEG files specified".into()); } - let use_dir = output.is_some() && files.len() > 1; + let mut use_dir = output.is_some() && files.len() > 1; if let Some(out) = &output { - if use_dir { + if out.is_dir() { + use_dir = true; + } + else if use_dir { let _ = fs::create_dir_all(out); } }