Fix sqlite db wrong path

This commit is contained in:
fromost
2025-10-09 16:56:50 +08:00
parent d660f25fb1
commit 2556781b45
3 changed files with 11 additions and 12 deletions

View File

@@ -1,7 +1,7 @@
use std::path::{PathBuf};
use ini::Ini;
use crate::config::types::{ApplicationConfig, BasicConfig};
use crate::constants::APP_CONFIG_DIR;
use crate::constants::{APP_CONFIG_DIR, APP_CONIFG_FILE_PATH};
pub mod types;
@@ -19,12 +19,14 @@ impl ApplicationConfig {
}
pub fn new() -> Self {
Self {
let conf = Self {
basic_config: BasicConfig {
db_path: APP_CONFIG_DIR.clone().to_str().unwrap().to_string(),
db_path: APP_CONFIG_DIR.clone().join("games.db").to_str().unwrap().to_string(),
tick_rate: 250
}
}
};
conf.clone().write_to_file(APP_CONIFG_FILE_PATH.to_path_buf());
conf
}
pub fn write_to_file(self, path: PathBuf) {