Fixed a bug where default database location was incorrect
This commit is contained in:
parent
48013dd16c
commit
2dace6b3d4
1 changed files with 7 additions and 3 deletions
10
src/main.rs
10
src/main.rs
|
@ -112,9 +112,13 @@ fn run() -> Result<()> {
|
||||||
|
|
||||||
// Init DB
|
// Init DB
|
||||||
println!("Starting up database");
|
println!("Starting up database");
|
||||||
let db_file_name = matches.opt_str("d").unwrap_or("db.sqlite".to_owned());
|
let db_path = matches.opt_str("d");
|
||||||
let db_file_path = Path::new(&db_file_name);
|
let mut default_db_path = utils::get_data_root()?;
|
||||||
let db = Arc::new(db::DB::new(&db_file_path)?);
|
default_db_path.push("db.sqlite");
|
||||||
|
let db_path = db_path
|
||||||
|
.map(|n| Path::new(n.as_str()).to_path_buf())
|
||||||
|
.unwrap_or(default_db_path);
|
||||||
|
let db = Arc::new(db::DB::new(&db_path)?);
|
||||||
|
|
||||||
// Parse config
|
// Parse config
|
||||||
let config_file_name = matches.opt_str("c");
|
let config_file_name = matches.opt_str("c");
|
||||||
|
|
Loading…
Add table
Reference in a new issue