mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
mtxchat simplify create pddb::dict mtxchat
This commit is contained in:
parent
a7d3b34563
commit
e1f1ac427b
1 changed files with 7 additions and 21 deletions
|
|
@ -100,27 +100,13 @@ impl<'a> MtxChat<'a> {
|
||||||
listening: false,
|
listening: false,
|
||||||
modals: modals,
|
modals: modals,
|
||||||
};
|
};
|
||||||
let mut keypath = PathBuf::new();
|
|
||||||
keypath.push(MTXCHAT_DICT);
|
// create the mtxchat dict if it does not exist
|
||||||
if !std::fs::metadata(&keypath).is_ok() {
|
let pddb = pddb::Pddb::new();
|
||||||
common.modals
|
pddb.try_mount();
|
||||||
.show_notification("mtxchat dict DOES NOT exist", None)
|
match pddb.get(MTXCHAT_DICT, USER_DOMAIN_KEY, None, true, false, None, None::<fn()>) {
|
||||||
.expect("notification failed");
|
Ok(_) => {}
|
||||||
log::info!("dict '{}' does NOT exist.. creating it", MTXCHAT_DICT);
|
Err(e) => log::warn!("failed to create dict: {:?}", e),
|
||||||
match std::fs::create_dir_all(&keypath) {
|
|
||||||
Ok(_) => {
|
|
||||||
common.modals
|
|
||||||
.show_notification("created mtxchat dict", None)
|
|
||||||
.expect("notification failed");
|
|
||||||
log::info!("created dict: {}", MTXCHAT_DICT);
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
common.modals
|
|
||||||
.show_notification("failed to creat mtxchat dict", None)
|
|
||||||
.expect("notification failed");
|
|
||||||
log::warn!("failed to create dict: {:?}", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
common
|
common
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue