diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-11-05 12:30:46 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-11-05 12:30:46 +0100 |
| commit | e26b431beef22cf99a53035df030f5eaab7c65ce (patch) | |
| tree | eabc76e77ecb97792c35b29bb403863f05dec079 /src | |
| parent | ee38c6aa9adefe4ca3ddc4aef22a216d7fb4c048 (diff) | |
Produce output file in current directory instead of source directory 📂
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 5 |
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]) }; |
