default profile falls back to built-in defaults
This commit is contained in:
1 parent
b2d72f2dc9
commit
193c6cd9eb
3 files changed
+21
-2
No files matched your search
+7
-2
@@ -94,8 +94,13 @@ impl Profile {
|
||||
let path = crate::config_dir()
|
||||
.join("profiles")
|
||||
.join(format!("{name}.toml"));
|
||||
let s = std::fs::read_to_string(&path)
|
||||
.with_context(|| format!("profile {}", path.display()))?;
|
||||
let s = match std::fs::read_to_string(&path) {
|
||||
// only the implicit profile may be missing; a typo in any other name must still fail
|
||||
Err(e) if name == "default" && e.kind() == std::io::ErrorKind::NotFound => {
|
||||
String::new()
|
||||
}
|
||||
r => r.with_context(|| format!("profile {}", path.display()))?,
|
||||
};
|
||||
Self::parse(&s).with_context(|| path.display().to_string())
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user