mirror of
https://github.com/NotAShelf/stash.git
synced 2026-04-13 14:33:47 +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]]
|
[[package]]
|
||||||
name = "stash"
|
name = "stash"
|
||||||
version = "0.2.2"
|
version = "0.2.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"clap",
|
"clap",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "stash"
|
name = "stash"
|
||||||
version = "0.2.2"
|
version = "0.2.3"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
authors = ["NotAShelf <raf@notashelf.dev>"]
|
authors = ["NotAShelf <raf@notashelf.dev>"]
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,13 @@ fn main() {
|
||||||
.join("db")
|
.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| {
|
let conn = rusqlite::Connection::open(&db_path).unwrap_or_else(|e| {
|
||||||
log::error!("Failed to open SQLite database: {e}");
|
log::error!("Failed to open SQLite database: {e}");
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue