mirror of
https://github.com/sharkdp/bat
synced 2024-11-12 13:10:42 +00:00
bat cache --build: Print syntect error message for themes if any
This will fix #614 by making it clear what is wrong by showing the following error message: Failed to load one or more themes from '/Users/me/.config/bat/themes' (reason: 'Invalid syntax theme settings') We also need to add a check if theme_dir.exists(), otherwise an absent dir will seem like an error: Failed to load one or more themes from '/Users/me/.config/bat/themes' (reason: 'IO error for operation on /Users/me/.config/bat/themes: No such file or directory (os error 2)') (This is the same check we already have for syntax_dir.)
This commit is contained in:
parent
9c16571347
commit
05e9da390f
@ -38,9 +38,16 @@ impl HighlightingAssets {
|
||||
};
|
||||
|
||||
let theme_dir = source_dir.join("themes");
|
||||
|
||||
let res = theme_set.add_from_folder(&theme_dir);
|
||||
if res.is_err() {
|
||||
if theme_dir.exists() {
|
||||
let res = theme_set.add_from_folder(&theme_dir);
|
||||
if let Err(err) = res {
|
||||
println!(
|
||||
"Failed to load one or more themes from '{}' (reason: '{}')",
|
||||
theme_dir.to_string_lossy(),
|
||||
err,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
println!(
|
||||
"No themes were found in '{}', using the default set",
|
||||
theme_dir.to_string_lossy()
|
||||
|
Loading…
Reference in New Issue
Block a user