fix: create store dir if not exists

feat/type-attributes
Tomáš Mládek 2022-09-18 15:27:37 +02:00
parent 3eadde0b23
commit f584aec97c
1 changed files with 5 additions and 4 deletions

View File

@ -90,11 +90,12 @@ pub struct FsStore {
impl FsStore {
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<FsStore> {
let path = path.as_ref().to_path_buf().canonicalize()?;
let store_dir = path.join(UPEND_SUBDIR);
if !store_dir.exists() {
fs::create_dir(&store_dir)?;
}
let manager = ConnectionManager::<SqliteConnection>::new(
path.join(UPEND_SUBDIR)
.join("upend_vault.sqlite3")
.to_str()
.unwrap(),
store_dir.join("upend_vault.sqlite3").to_str().unwrap(),
);
let pool = r2d2::Pool::builder()
.connection_customizer(Box::new(ConnectionOptions {}))