diff options
Diffstat (limited to 'kittybox-rs/src')
-rw-r--r-- | kittybox-rs/src/database/file/mod.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/kittybox-rs/src/database/file/mod.rs b/kittybox-rs/src/database/file/mod.rs index 8514717..fe53ea5 100644 --- a/kittybox-rs/src/database/file/mod.rs +++ b/kittybox-rs/src/database/file/mod.rs @@ -316,9 +316,7 @@ impl Storage for FileStorage { .parent() .expect("Parent for this directory should always exist") .to_owned(); - if !(spawn_blocking(move || parent.is_dir()).await.unwrap()) { - tokio::fs::create_dir_all(path.parent().unwrap()).await?; - } + tokio::fs::create_dir_all(&parent).await?; let mut file = tokio::fs::OpenOptions::new() .write(true) @@ -378,6 +376,7 @@ impl Storage for FileStorage { path.to_path(&self.root_dir) }; + tokio::fs::create_dir_all(path.parent().unwrap()).await?; tracing::debug!("Channels file path: {}", path.display()); let tempfilename = path.with_extension("tmp"); let channel_name = post["properties"]["name"][0] @@ -643,9 +642,7 @@ impl Storage for FileStorage { let temppath = path.with_extension("tmp"); let parent = path.parent().unwrap().to_owned(); - if !spawn_blocking(move || parent.is_dir()).await.unwrap() { - tokio::fs::create_dir_all(path.parent().unwrap()).await?; - } + tokio::fs::create_dir_all(&parent).await?; let mut tempfile = OpenOptions::new() .write(true) |