Ignore nonexistent config imports instead of raising an error

Fixes: #4330.
This commit is contained in:
James Simpson 2020-11-19 09:52:58 -05:00 committed by GitHub
parent 18a226fe45
commit c1f0e83cbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## 0.7.0-dev
### Changed
- Nonexistent config imports are ignored instead of raising an error
### Fixed
- Wide characters sometimes being cut off

View File

@ -4,7 +4,7 @@
#
# These configuration files will be loaded in order, replacing values in files
# loaded earlier with those loaded later in the chain. The file itself will
# always be loaded last.
# always be loaded last. If an import path cannot be found it will be skipped.
#import:
# - /path/to/alacritty.yml

View File

@ -222,6 +222,12 @@ fn load_imports(config: &Value, config_paths: &mut Vec<PathBuf>, recursion_limit
},
};
if !path.exists() {
info!(target: LOG_TARGET_CONFIG, "Skipping importing config; not found:");
info!(target: LOG_TARGET_CONFIG, " {:?}", path.display());
continue;
}
match parse_config(&path, config_paths, recursion_limit - 1) {
Ok(config) => merged = serde_utils::merge(merged, config),
Err(err) => {