summaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/config.rs b/src/config.rs
index 817d22b..61db1c7 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -1,11 +1,12 @@
1use std::{ 1use std::{
2 fs::{File, create_dir_all}, 2 fs::{create_dir_all, File},
3 io::{Read, Write}, path::Path, 3 io::{Read, Write},
4 path::Path,
4}; 5};
5 6
6use serde::{Deserialize, Serialize}; 7use serde::{Deserialize, Serialize};
7 8
8use crate::{error::MLE, db::db_setup}; 9use crate::{db::db_setup, error::MLE};
9 10
10#[derive(Debug, Clone, Serialize, Deserialize)] 11#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct Cfg { 12pub struct Cfg {
@@ -23,7 +24,11 @@ impl Cfg {
23 pub fn init(path: Option<String>) -> MLE<Self> { 24 pub fn init(path: Option<String>) -> MLE<Self> {
24 let configfile = match path.clone() { 25 let configfile = match path.clone() {
25 Some(p) => String::from(p), 26 Some(p) => String::from(p),
26 None => dirs::config_dir().unwrap().join("modlist.toml").to_string_lossy().to_string(), 27 None => dirs::config_dir()
28 .unwrap()
29 .join("modlist.toml")
30 .to_string_lossy()
31 .to_string(),
27 }; 32 };
28 33
29 let mut file = match File::open(&configfile) { 34 let mut file = match File::open(&configfile) {