Skip to content

Commit

Permalink
save DB to ~/.contender/
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroXbrock committed Jan 8, 2025
1 parent 0d3aab8 commit 93c75aa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ use contender_core::{db::DbOps, generator::RandSeed};
use contender_sqlite::SqliteDb;

static DB: LazyLock<SqliteDb> = std::sync::LazyLock::new(|| {
SqliteDb::from_file("contender.db").expect("failed to open contender.db")
let path = &format!(
"{}{}",
std::env::var("HOME").unwrap(),
"/.contender/contender.db"
);
println!("opening DB at {}", path);
std::fs::create_dir_all(std::env::var("HOME").unwrap() + "/.contender")
.expect("failed to create ~/.contender directory");
SqliteDb::from_file(path).expect("failed to open contender DB file")
});

#[tokio::main]
Expand Down

0 comments on commit 93c75aa

Please sign in to comment.