summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs5
-rw-r--r--src/main.rs7
2 files changed, 6 insertions, 6 deletions
diff --git a/src/lib.rs b/src/lib.rs
index b48bf61..f18bdfb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -76,7 +76,7 @@ pub fn load_game_versions(path: &str) -> MLE<Vec<GameVersion>> {
76 let versions: Vec<GameVersion> = serde_json::from_str(&data)?; 76 let versions: Vec<GameVersion> = serde_json::from_str(&data)?;
77 Ok(versions) 77 Ok(versions)
78} 78}
79 79
80impl VersionLevel { 80impl VersionLevel {
81 81
82 pub fn from(str: &str) -> Self { 82 pub fn from(str: &str) -> Self {
@@ -87,8 +87,9 @@ impl VersionLevel {
87 } 87 }
88 } 88 }
89 89
90 pub fn get(self, versions_path: &str) -> MLE<String> { 90 pub async fn get(self, versions_path: &str, force_update: bool) -> MLE<String> {
91 let path = format!("{}/versions.json", versions_path); 91 let path = format!("{}/versions.json", versions_path);
92 check_game_versions(&path, force_update).await?;
92 let mut versions = load_game_versions(&path)?.into_iter(); 93 let mut versions = load_game_versions(&path)?.into_iter();
93 94
94 match self { 95 match self {
diff --git a/src/main.rs b/src/main.rs
index 93da718..b12e3e4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -3,7 +3,7 @@ use modlist::{
3 config::Cfg, 3 config::Cfg,
4 db::{config_get_current_list, lists_get, lists_get_all_ids}, 4 db::{config_get_current_list, lists_get, lists_get_all_ids},
5 download, export, get_current_list, import, list_add, list_change, list_remove, list_version, 5 download, export, get_current_list, import, list_add, list_change, list_remove, list_version,
6 mod_add, mod_remove, update, IDSelector, List, Modloader, check_game_versions, VersionLevel, 6 mod_add, mod_remove, update, IDSelector, List, Modloader, VersionLevel,
7}; 7};
8 8
9//TODO implement remote sql db 9//TODO implement remote sql db
@@ -153,7 +153,6 @@ async fn main() {
153 let cli = Cli::parse(); 153 let cli = Cli::parse();
154 154
155 let config = Cfg::init(cli.config).await.unwrap(); 155 let config = Cfg::init(cli.config).await.unwrap();
156 check_game_versions(format!("{}/versions.json", config.versions).as_str(), cli.force_gameupdate).await.unwrap();
157 156
158 match cli.command { 157 match cli.command {
159 Commands::Mod { command } => { 158 Commands::Mod { command } => {
@@ -212,8 +211,8 @@ async fn main() {
212 211
213 let versions_path = &config.versions; 212 let versions_path = &config.versions;
214 let ver = match version { 213 let ver = match version {
215 Some(ver) => VersionLevel::from(&ver).get(versions_path).unwrap(), 214 Some(ver) => VersionLevel::from(&ver).get(versions_path, cli.force_gameupdate).await.unwrap(),
216 None => config.clone().defaults.version.get(versions_path).unwrap(), 215 None => config.clone().defaults.version.get(versions_path, cli.force_gameupdate).await.unwrap(),
217 }; 216 };
218 217
219 list_add(config, id, ver, ml, directory) 218 list_add(config, id, ver, ml, directory)