Skip to content

Commit

Permalink
Fix template name when no xyz file is passed (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
caprilesport authored Jan 21, 2024
1 parent 1ac6d93 commit 33f1e78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,13 @@ fn generate_input(
let mut results: Vec<Input> = vec![];

if molecules.is_empty() {
let filename = PathBuf::from(&template.name).with_extension(extension);
let filename = filename
.file_name()
.ok_or(anyhow!("Can't retrieve template name, exiting.."))?;

results.push(Input {
filename: PathBuf::from(&template.name).with_extension(extension),
filename: PathBuf::from(filename),
content: template.render(&context)?,
});
}
Expand Down
1 change: 0 additions & 1 deletion src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ impl Template {
]
.iter()
.collect();
println!("{:?}", template_path);
Ok(template_path)
}

Expand Down

0 comments on commit 33f1e78

Please sign in to comment.