bail! in render() if specified theme directory does not exist

This commit is contained in:
Clark 2022-04-26 20:20:44 +08:00
parent e1c2e1a753
commit a60571321a
1 changed files with 7 additions and 1 deletions

View File

@ -481,7 +481,13 @@ impl Renderer for HtmlHandlebars {
let mut handlebars = Handlebars::new(); let mut handlebars = Handlebars::new();
let theme_dir = match html_config.theme { let theme_dir = match html_config.theme {
Some(ref theme) => ctx.root.join(theme), Some(ref theme) => {
let dir = ctx.root.join(theme);
if !dir.is_dir() {
bail!("theme dir {} does not exist", dir.display());
}
dir
}
None => ctx.root.join("theme"), None => ctx.root.join("theme"),
}; };