replace HOME env var panics with dirs::home_dir()
Four expect("HOME not set") calls in config.rs and one unwrap()
in admin.rs would panic if HOME wasn't set. Use dirs::home_dir()
consistently for portability.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
65ae8d483c
commit
1af8fb2a9d
2 changed files with 5 additions and 5 deletions
|
|
@ -46,7 +46,7 @@ pub fn cmd_init() -> Result<(), String> {
|
|||
let config_path = std::env::var("POC_MEMORY_CONFIG")
|
||||
.map(std::path::PathBuf::from)
|
||||
.unwrap_or_else(|_| {
|
||||
std::path::PathBuf::from(std::env::var("HOME").unwrap())
|
||||
dirs::home_dir().unwrap_or_default()
|
||||
.join(".consciousness/config.jsonl")
|
||||
});
|
||||
if !config_path.exists() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue