aboutsummaryrefslogtreecommitdiffstats
path: root/src/db.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/db.rs')
-rw-r--r--src/db.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/db.rs b/src/db.rs
index 7e94d73..a750693 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -45,6 +45,8 @@ impl Db {
// XXX need to make this atomic
pub fn save(&self, email: &str) -> Result<()> {
let filename = Self::filename(email);
+ // unwrap is safe here because Self::filename is explicitly
+ // constructed as a filename in a directory
std::fs::create_dir_all(filename.parent().unwrap())
.context(crate::error::SaveDb)?;
let mut fh =
@@ -61,6 +63,8 @@ impl Db {
// XXX need to make this atomic
pub async fn save_async(&self, email: &str) -> Result<()> {
let filename = Self::filename(email);
+ // unwrap is safe here because Self::filename is explicitly
+ // constructed as a filename in a directory
tokio::fs::create_dir_all(filename.parent().unwrap())
.await
.context(crate::error::SaveDbAsync)?;