mirror of
https://github.com/NotAShelf/stash.git
synced 2026-04-12 22:17:41 +00:00
Merge pull request #9 from NotAShelf/notashelf/push-klsuwwwrwuqn
stash: create database directory automatically if missing
This commit is contained in:
commit
351b98c921
3 changed files with 9 additions and 2 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -953,7 +953,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "stash"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"clap",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "stash"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
edition = "2024"
|
||||
authors = ["NotAShelf <raf@notashelf.dev>"]
|
||||
license = "MPL-2.0"
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue