fix: create store dir if not exists
parent
3eadde0b23
commit
f584aec97c
|
@ -90,11 +90,12 @@ pub struct FsStore {
|
||||||
impl FsStore {
|
impl FsStore {
|
||||||
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<FsStore> {
|
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<FsStore> {
|
||||||
let path = path.as_ref().to_path_buf().canonicalize()?;
|
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(
|
let manager = ConnectionManager::<SqliteConnection>::new(
|
||||||
path.join(UPEND_SUBDIR)
|
store_dir.join("upend_vault.sqlite3").to_str().unwrap(),
|
||||||
.join("upend_vault.sqlite3")
|
|
||||||
.to_str()
|
|
||||||
.unwrap(),
|
|
||||||
);
|
);
|
||||||
let pool = r2d2::Pool::builder()
|
let pool = r2d2::Pool::builder()
|
||||||
.connection_customizer(Box::new(ConnectionOptions {}))
|
.connection_customizer(Box::new(ConnectionOptions {}))
|
||||||
|
|
Loading…
Reference in New Issue