Skip to content

Commit

Permalink
fix: Ignore directories when rebuilding cache if they do not exist. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kenielf authored Sep 26, 2024
1 parent 16418d4 commit 70cc0fd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@ impl HighlightingAssets {

pub fn add_from_folder<P: AsRef<Path>>(&mut self, path: P) -> Result<()> {
let path = path.as_ref();
self.theme_set.add_from_folder(path.join("themes"))?;
let theme_dir = path.join("themes");
if theme_dir.is_dir() {
self.theme_set.add_from_folder(theme_dir)?;
}
let mut builder = self.syntax_set.clone().into_builder();
builder.add_from_folder(path.join("syntaxes"), true)?;
self.syntax_set = builder.build();
let syntaxes_dir = path.join("syntaxes");
if syntaxes_dir.is_dir() {
builder.add_from_folder(syntaxes_dir, true)?;
self.syntax_set = builder.build();
}
Ok(())
}

Expand Down

0 comments on commit 70cc0fd

Please sign in to comment.