diff options
author | fxqnlr <[email protected]> | 2023-04-30 20:11:10 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2023-04-30 20:11:10 +0200 |
commit | e8cac6786bc2e91382316ef1023a494c3e812013 (patch) | |
tree | b8b463cfbbea2290829b1a53d4835ee8fb2742c5 /src/config.rs | |
parent | 06f933dac333d58b2cc3ae7ab0c285e5015a0257 (diff) | |
download | modlist-e8cac6786bc2e91382316ef1023a494c3e812013.tar modlist-e8cac6786bc2e91382316ef1023a494c3e812013.tar.gz modlist-e8cac6786bc2e91382316ef1023a494c3e812013.zip |
added modloader default to config
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/config.rs b/src/config.rs index 9064548..cf27257 100644 --- a/src/config.rs +++ b/src/config.rs | |||
@@ -6,12 +6,13 @@ use std::{ | |||
6 | 6 | ||
7 | use serde::{Deserialize, Serialize}; | 7 | use serde::{Deserialize, Serialize}; |
8 | 8 | ||
9 | use crate::{db::db_setup, error::MLE}; | 9 | use crate::{db::db_setup, error::MLE, Modloader}; |
10 | 10 | ||
11 | #[derive(Debug, Clone, Serialize, Deserialize)] | 11 | #[derive(Debug, Clone, Serialize, Deserialize)] |
12 | pub struct Cfg { | 12 | pub struct Cfg { |
13 | pub data: String, | 13 | pub data: String, |
14 | pub cache: String, | 14 | pub cache: String, |
15 | pub defaults: Defaults, | ||
15 | pub apis: Apis, | 16 | pub apis: Apis, |
16 | } | 17 | } |
17 | 18 | ||
@@ -20,6 +21,11 @@ pub struct Apis { | |||
20 | pub modrinth: String, | 21 | pub modrinth: String, |
21 | } | 22 | } |
22 | 23 | ||
24 | #[derive(Debug, Clone, Serialize, Deserialize)] | ||
25 | pub struct Defaults { | ||
26 | pub modloader: Modloader, | ||
27 | } | ||
28 | |||
23 | impl Cfg { | 29 | impl Cfg { |
24 | pub fn init(path: Option<String>) -> MLE<Self> { | 30 | pub fn init(path: Option<String>) -> MLE<Self> { |
25 | let configfile = match path.clone() { | 31 | let configfile = match path.clone() { |
@@ -72,6 +78,9 @@ fn create_config(path: &str) -> MLE<()> { | |||
72 | let default_cfg = Cfg { | 78 | let default_cfg = Cfg { |
73 | data: cache_dir.clone(), | 79 | data: cache_dir.clone(), |
74 | cache: format!("{}/cache", cache_dir), | 80 | cache: format!("{}/cache", cache_dir), |
81 | defaults: Defaults { | ||
82 | modloader: Modloader::Fabric | ||
83 | }, | ||
75 | apis: Apis { | 84 | apis: Apis { |
76 | modrinth: String::from("https://api.modrinth.com/v2/"), | 85 | modrinth: String::from("https://api.modrinth.com/v2/"), |
77 | }, | 86 | }, |