fix sqlite path
This commit is contained in:
parent
1f365c8409
commit
3d5a504302
2 changed files with 8 additions and 6 deletions
|
@ -31,9 +31,9 @@ async fn main() -> Result<()> {
|
||||||
|
|
||||||
// Open SRS db
|
// Open SRS db
|
||||||
let srs_db_path = app_dir.join("srs_db.sqlite");
|
let srs_db_path = app_dir.join("srs_db.sqlite");
|
||||||
let srs_db_path_str = srs_db_path.display().to_string();
|
let srs_db_options = SqliteConnectOptions::new()
|
||||||
let srs_db_options =
|
.filename(&srs_db_path)
|
||||||
SqliteConnectOptions::from_str(&srs_db_path_str)?.create_if_missing(true);
|
.create_if_missing(true);
|
||||||
println!("Opening srs database at {} ...", srs_db_path.display());
|
println!("Opening srs database at {} ...", srs_db_path.display());
|
||||||
let srs_pool = SqlitePoolOptions::new()
|
let srs_pool = SqlitePoolOptions::new()
|
||||||
.connect_with(srs_db_options)
|
.connect_with(srs_db_options)
|
||||||
|
@ -58,11 +58,12 @@ async fn main() -> Result<()> {
|
||||||
.path_resolver()
|
.path_resolver()
|
||||||
.resolve_resource("./KanjiDatabase.sqlite")
|
.resolve_resource("./KanjiDatabase.sqlite")
|
||||||
.expect("failed to resolve resource");
|
.expect("failed to resolve resource");
|
||||||
|
println!("resource path: {}", resource_path.display());
|
||||||
|
|
||||||
// Open kanji db
|
// Open kanji db
|
||||||
let resource_path_str = resource_path.display().to_string();
|
let kanji_db_options = SqliteConnectOptions::new()
|
||||||
let kanji_db_options =
|
.filename(&resource_path)
|
||||||
SqliteConnectOptions::from_str(&resource_path_str)?.read_only(true);
|
.read_only(true);
|
||||||
let kanji_pool =
|
let kanji_pool =
|
||||||
SqlitePoolOptions::new().connect_lazy_with(kanji_db_options);
|
SqlitePoolOptions::new().connect_lazy_with(kanji_db_options);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use std::{
|
use std::{
|
||||||
ops::Add,
|
ops::Add,
|
||||||
|
path::Path,
|
||||||
time::{Duration, SystemTime, SystemTimeError, UNIX_EPOCH},
|
time::{Duration, SystemTime, SystemTimeError, UNIX_EPOCH},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue