diff --git a/Cargo.lock b/Cargo.lock index efbc845..1928763 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -953,7 +953,7 @@ dependencies = [ [[package]] name = "stash" -version = "0.2.2" +version = "0.2.3" dependencies = [ "base64", "clap", diff --git a/Cargo.toml b/Cargo.toml index 66772a1..71ff39c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "stash" -version = "0.2.2" +version = "0.2.3" edition = "2024" authors = ["NotAShelf "] license = "MPL-2.0" diff --git a/src/main.rs b/src/main.rs index 0e8128f..f41ccac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -107,6 +107,13 @@ fn main() { .join("db") }); + if let Some(parent) = db_path.parent() { + if let Err(e) = std::fs::create_dir_all(parent) { + log::error!("Failed to create database directory: {e}"); + process::exit(1); + } + } + let conn = rusqlite::Connection::open(&db_path).unwrap_or_else(|e| { log::error!("Failed to open SQLite database: {e}"); process::exit(1);