From e26b431beef22cf99a53035df030f5eaab7c65ce Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 5 Nov 2020 12:30:46 +0100 Subject: [PATCH] =?UTF-8?q?Produce=20output=20file=20in=20current=20direct?= =?UTF-8?q?ory=20instead=20of=20source=20directory=20=F0=9F=93=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 578ceb9ca..17dc67c48 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,7 +22,10 @@ fn main() { let src_path = Path::new(&args[1]); let dest_path = if args.len() <= 2 { - src_path.with_extension("pdf") + let name = src_path + .file_name() + .expect("source path is not a file"); + Path::new(name).with_extension("pdf") } else { PathBuf::from(&args[2]) };