Fix sqlite db wrong path
This commit is contained in:
11
src/app.rs
11
src/app.rs
@@ -14,12 +14,7 @@ use ratatui::prelude::{Widget};
|
||||
use ratatui::style::{Color, Style};
|
||||
use ratatui::text::{Line, Span, Text};
|
||||
use crate::config::types::ApplicationConfig;
|
||||
use crate::constants::{APP_CONFIG_DIR, APP_DATA_DIR};
|
||||
|
||||
lazy_static! {
|
||||
static ref APP_CONIFG_FILE_PATH: PathBuf = APP_CONFIG_DIR.clone()
|
||||
.join("config.ini");
|
||||
}
|
||||
use crate::constants::{APP_CONFIG_DIR, APP_CONIFG_FILE_PATH, APP_DATA_DIR};
|
||||
|
||||
pub(crate) struct App {
|
||||
running: bool,
|
||||
@@ -33,8 +28,8 @@ impl App {
|
||||
let app_conf =
|
||||
if APP_CONIFG_FILE_PATH.exists() { ApplicationConfig::from_file(&APP_CONIFG_FILE_PATH) }
|
||||
else { ApplicationConfig::new() };
|
||||
Self::initialize();
|
||||
let db_conn = Self::establish_db_connection(app_conf.clone());
|
||||
Self::initialize(&db_conn);
|
||||
App {
|
||||
running: true,
|
||||
events: EventHandler::new(Duration::from_millis(app_conf.basic_config.tick_rate)),
|
||||
@@ -43,7 +38,7 @@ impl App {
|
||||
}
|
||||
}
|
||||
|
||||
fn initialize(db_conn: &SqliteConnection) {
|
||||
fn initialize() {
|
||||
if !APP_CONFIG_DIR.exists() {
|
||||
std::fs::create_dir_all(APP_CONFIG_DIR.as_path()).unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user