fix(snix/castore,snix/store): Create parent directory when creating redb services

Change-Id: I0b3083cbbb865d4b724d2b30305c10f2a779bce4
Reviewed-on: https://cl.snix.dev/c/snix/+/30646
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
This commit is contained in:
Mai 2025-08-05 00:14:40 +03:00
parent 05a9715a20
commit 8e609804b9
2 changed files with 8 additions and 0 deletions

View file

@ -36,6 +36,10 @@ impl RedbDirectoryService {
));
}
if let Some(parent) = path.parent() {
std::fs::create_dir_all(parent)?;
}
let db = tokio::task::spawn_blocking(|| -> Result<_, redb::Error> {
let db = redb::Database::create(path)?;
create_schema(&db)?;

View file

@ -35,6 +35,10 @@ impl RedbPathInfoService {
));
}
if let Some(parent) = path.parent() {
std::fs::create_dir_all(parent)?;
}
let db = tokio::task::spawn_blocking(|| -> Result<_, redb::Error> {
let db = redb::Database::create(path)?;
create_schema(&db)?;