From 4e6466af1329f7b9e341df2e76ab696d11f80c93 Mon Sep 17 00:00:00 2001 From: FxQnLr Date: Thu, 27 Apr 2023 10:08:20 +0200 Subject: version bump, cargo fmt and cargo update --- src/files.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/files.rs') diff --git a/src/files.rs b/src/files.rs index a73fc18..59fc7de 100644 --- a/src/files.rs +++ b/src/files.rs @@ -2,20 +2,20 @@ use futures_util::StreamExt; use reqwest::Client; use std::{ collections::HashMap, - fs::{read_dir, remove_file, rename, File, copy}, + fs::{copy, read_dir, remove_file, rename, File}, io::Write, }; use crate::{ + cache::{copy_cached_version, get_cached_versions}, config::Cfg, db::{mods_get_info, userlist_add_disabled_versions}, error::{ErrorType, MLError, MLE}, modrinth::Version, - List, cache::{get_cached_versions, copy_cached_version}, + List, }; pub async fn download_versions(list: List, config: Cfg, versions: Vec) -> MLE { - let mut cached = get_cached_versions(&config.cache); println!("{:#?}", cached); @@ -30,7 +30,10 @@ pub async fn download_versions(list: List, config: Cfg, versions: Vec) //Check cache if already downloaded let c = cached.remove(&ver.id); if c.is_some() { - print!("\t└({})Get version {} from cache", project_info.title, ver.id); + print!( + "\t└({})Get version {} from cache", + project_info.title, ver.id + ); //Force flush of stdout, else print! doesn't print instantly std::io::stdout().flush()?; copy_cached_version(&c.unwrap(), &dl_path); @@ -52,7 +55,12 @@ pub async fn download_versions(list: List, config: Cfg, versions: Vec) ver.id, extension ); - download_file(primary_file.url, list.clone().download_folder, filename.clone()).await?; + download_file( + primary_file.url, + list.clone().download_folder, + filename.clone(), + ) + .await?; println!(" ✓"); //Copy file to cache print!("\t └Copy to cache"); @@ -64,7 +72,6 @@ pub async fn download_versions(list: List, config: Cfg, versions: Vec) copy(dl_path_file, cache_path)?; println!(" ✓"); } - } Ok(dl_path) -- cgit v1.2.3