summaryrefslogtreecommitdiff
path: root/src/files.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2023-02-05 09:23:29 +0100
committerfxqnlr <[email protected]>2023-02-05 09:23:29 +0100
commitff23a11e632812b685f594324e6004c6da81cd4d (patch)
tree2b503cb25d8ebfbc33d449860e1903a4c6c9513f /src/files.rs
parent2f4b5f1584f88491ea4a6902d69382a0e73aa76d (diff)
downloadmodlist-ff23a11e632812b685f594324e6004c6da81cd4d.tar
modlist-ff23a11e632812b685f594324e6004c6da81cd4d.tar.gz
modlist-ff23a11e632812b685f594324e6004c6da81cd4d.zip
Fixed update shit not correctly updating
Diffstat (limited to 'src/files.rs')
-rw-r--r--src/files.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/files.rs b/src/files.rs
index 8c822b2..b9325ea 100644
--- a/src/files.rs
+++ b/src/files.rs
@@ -2,17 +2,17 @@ use std::{fs::{File, read_dir, remove_file, rename}, io::Write, collections::Has
2use futures_util::StreamExt; 2use futures_util::StreamExt;
3use reqwest::Client; 3use reqwest::Client;
4 4
5use crate::{List, modrinth::Version, db::{userlist_add_disabled_versions, mods_get_name}, config::Cfg, error::{MLE, MLError, ErrorType}}; 5use crate::{List, modrinth::Version, db::{userlist_add_disabled_versions, mods_get_title}, config::Cfg, error::{MLE, MLError, ErrorType}};
6 6
7pub async fn download_versions(list: List, config: Cfg, versions: Vec<Version>) -> MLE<String> { 7pub async fn download_versions(list: List, config: Cfg, versions: Vec<Version>) -> MLE<String> {
8 8
9 let dl_path = String::from(&list.download_folder); 9 let dl_path = String::from(&list.download_folder);
10 10
11 println!("Download to directory from: {} ({})", list.id, dl_path); 11 println!("Download mods to {}", dl_path);
12 12
13 for ver in versions { 13 for ver in versions {
14 let project_name = mods_get_name(config.clone(), &ver.project_id)?; 14 let project_name = mods_get_title(config.clone(), &ver.project_id)?;
15 print!("\t({})Download version {}", project_name, ver.id); 15 print!("\t({})Download version {}", project_name, ver.id);
16 //Force flush of stdout, else print! doesn't print instantly 16 //Force flush of stdout, else print! doesn't print instantly
17 std::io::stdout().flush().unwrap(); 17 std::io::stdout().flush().unwrap();
18 let primary_file = ver.files.into_iter().find(|file| file.primary).unwrap(); 18 let primary_file = ver.files.into_iter().find(|file| file.primary).unwrap();
@@ -107,7 +107,7 @@ pub fn get_downloaded_versions(list: List) -> MLE<HashMap<String, String>> {
107 107
108pub fn clean_list_dir(list: &List) -> MLE<()> { 108pub fn clean_list_dir(list: &List) -> MLE<()> {
109 let dl_path = &list.download_folder; 109 let dl_path = &list.download_folder;
110 println!("Clean directory for: {}", list.id); 110 println!("Clean directory for: {}", list.id);
111 for entry in std::fs::read_dir(dl_path)? { 111 for entry in std::fs::read_dir(dl_path)? {
112 let entry = entry?; 112 let entry = entry?;
113 std::fs::remove_file(entry.path())?; 113 std::fs::remove_file(entry.path())?;