summaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2023-04-30 20:11:10 +0200
committerfxqnlr <[email protected]>2023-04-30 20:11:10 +0200
commite8cac6786bc2e91382316ef1023a494c3e812013 (patch)
treeb8b463cfbbea2290829b1a53d4835ee8fb2742c5 /src/config.rs
parent06f933dac333d58b2cc3ae7ab0c285e5015a0257 (diff)
downloadmodlist-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.rs11
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
7use serde::{Deserialize, Serialize}; 7use serde::{Deserialize, Serialize};
8 8
9use crate::{db::db_setup, error::MLE}; 9use crate::{db::db_setup, error::MLE, Modloader};
10 10
11#[derive(Debug, Clone, Serialize, Deserialize)] 11#[derive(Debug, Clone, Serialize, Deserialize)]
12pub struct Cfg { 12pub 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)]
25pub struct Defaults {
26 pub modloader: Modloader,
27}
28
23impl Cfg { 29impl 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 },