fix(backtrace): Fix backtrace logging and stdout (#988)

* fix(backtrace): Fix backtrace logging and stdout
- Add manual implementation for panic that logs backtrace to a file.
- Remove all manual output to stdout.
- Fix new clippy warnings from Rust 1.65.

* Update docs

Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
This commit is contained in:
Thomas
2022-11-18 13:20:57 -08:00
committed by GitHub
parent 3db8d02295
commit e15657ae67
6 changed files with 63 additions and 20 deletions

View File

@@ -242,14 +242,24 @@ fn load(filename: &str) -> Result<ConfigValues, String> {
}
fn proj_dirs() -> AppDirs {
match *BASE_PATH.read().expect("can't readlock BASE_PATH") {
Some(ref basepath) => AppDirs {
try_proj_dirs().unwrap()
}
/// Returns the plaform app directories for ncspot if they could be determined,
/// or an error otherwise.
pub fn try_proj_dirs() -> Result<AppDirs, String> {
match *BASE_PATH
.read()
.map_err(|_| String::from("Poisoned RWLock"))?
{
Some(ref basepath) => Ok(AppDirs {
cache_dir: basepath.join(".cache"),
config_dir: basepath.join(".config"),
data_dir: basepath.join(".local/share"),
state_dir: basepath.join(".local/state"),
},
None => AppDirs::new(Some("ncspot"), true).expect("can't determine project paths"),
}),
None => AppDirs::new(Some("ncspot"), true)
.ok_or_else(|| String::from("Couldn't determine platform standard directories")),
}
}