Fix error loading non-existant themes directory and use default themes as the base when merging (#2411)
* Fix error loading non-existant themes directory If the themes directory is derived from the config directory (rather than being specified explicitly in the config_options), we will avoid trying to load from it if it doesn't exist. * Use default themes as the base when merging with the themes specified in the config. This avoids the default themes overriding themes specified in the config. * If `setup --clean` is used, avoid loading from the user's theme directory.
This commit is contained in:
parent
acb31c5322
commit
48e75d0559
1 changed files with 11 additions and 6 deletions
|
|
@ -320,14 +320,19 @@ impl Setup {
|
|||
None => config.options.clone(),
|
||||
};
|
||||
|
||||
config.themes = config.themes.merge(get_default_themes());
|
||||
config.themes = get_default_themes().merge(config.themes);
|
||||
|
||||
if let Some(Command::Setup(Setup { clean: false, .. })) = &cli_args.command {
|
||||
let user_theme_dir = config_options.theme_dir.clone().or_else(|| {
|
||||
get_theme_dir(cli_args.config_dir.clone().or_else(find_default_config_dir))
|
||||
// If theme dir is not explicitly specified in config_options,
|
||||
// only try to use it if it exists.
|
||||
.filter(|dir| dir.exists())
|
||||
});
|
||||
if let Some(user_theme_dir) = user_theme_dir {
|
||||
config.themes = config.themes.merge(Themes::from_dir(user_theme_dir)?);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(Command::Setup(ref setup)) = &cli_args.command {
|
||||
setup
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue