Skip to content

Commit

Permalink
log error message if specified theme directory does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
clement2026 committed Apr 24, 2022
1 parent e1c2e1a commit 0879109
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,13 @@ impl HtmlConfig {
/// directory is not present it will append the default directory of "theme"
pub fn theme_dir(&self, root: &Path) -> PathBuf {
match self.theme {
Some(ref d) => root.join(d),
Some(ref d) => {
let dir = root.join(d);
if !dir.is_dir() {
error!("theme dir {:?} does not exist", d);
}
dir
}
None => root.join("theme"),
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/renderer/html_handlebars/hbs_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,7 @@ impl Renderer for HtmlHandlebars {
trace!("render");
let mut handlebars = Handlebars::new();

let theme_dir = match html_config.theme {
Some(ref theme) => ctx.root.join(theme),
None => ctx.root.join("theme"),
};
let theme_dir = html_config.theme_dir(&ctx.root);

if html_config.theme.is_none()
&& maybe_wrong_theme_dir(&src_dir.join("theme")).unwrap_or(false)
Expand Down

0 comments on commit 0879109

Please sign in to comment.