Add basic dlsite crawler
Reformat application config
This commit is contained in:
@@ -7,6 +7,14 @@ use serde_json;
|
||||
pub mod types;
|
||||
|
||||
impl ApplicationConfig {
|
||||
pub fn get_config() -> Result<Self> {
|
||||
if APP_CONIFG_FILE_PATH.exists() {
|
||||
ApplicationConfig::from_file(&APP_CONIFG_FILE_PATH)
|
||||
} else {
|
||||
Ok(ApplicationConfig::new())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_file(path: &PathBuf) -> Result<Self> {
|
||||
let reader = std::fs::File::open(path)?;
|
||||
let result = serde_json::from_reader(reader)?;
|
||||
|
||||
Reference in New Issue
Block a user