Simplify SqliteStore::from_path

This commit is contained in:
Nick Mathewson 2021-08-06 09:33:09 -04:00
parent ca6b38d49e
commit 6d80e53232
1 changed files with 4 additions and 10 deletions

View File

@ -69,17 +69,11 @@ impl SqliteStore {
let blobpath = path.join("dir_blobs/"); let blobpath = path.join("dir_blobs/");
let lockpath = path.join("dir.lock"); let lockpath = path.join("dir.lock");
#[cfg(target_family = "unix")]
if !readonly { if !readonly {
std::fs::DirBuilder::new() let mut builder = std::fs::DirBuilder::new();
.recursive(true) #[cfg(target_family = "unix")]
.mode(0o700) builder.mode(0o700);
.create(&blobpath) builder
.with_context(|| format!("Creating directory at {:?}", &blobpath))?;
}
#[cfg(not(target_family = "unix"))]
if !readonly {
std::fs::DirBuilder::new()
.recursive(true) .recursive(true)
.create(&blobpath) .create(&blobpath)
.with_context(|| format!("Creating directory at {:?}", &blobpath))?; .with_context(|| format!("Creating directory at {:?}", &blobpath))?;