summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-11-05 12:30:46 +0100
committerLaurenz <laurmaedje@gmail.com>2020-11-05 12:30:46 +0100
commite26b431beef22cf99a53035df030f5eaab7c65ce (patch)
treeeabc76e77ecb97792c35b29bb403863f05dec079 /src
parentee38c6aa9adefe4ca3ddc4aef22a216d7fb4c048 (diff)
Produce output file in current directory instead of source directory 📂
Diffstat (limited to 'src')
-rw-r--r--src/main.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 578ceb9c..17dc67c4 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])
};