summaryrefslogtreecommitdiff
path: root/src/commands/download.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/download.rs')
-rw-r--r--src/commands/download.rs13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/commands/download.rs b/src/commands/download.rs
index 0f63876..7748d15 100644
--- a/src/commands/download.rs
+++ b/src/commands/download.rs
@@ -1,4 +1,4 @@
1use crate::{files::{get_downloaded_versions, download_versions, delete_version, disable_version}, db::{userlist_get_all_current_versions_with_mods, lists_get_all_ids, lists_get}, modrinth::get_raw_versions, error::{MLE, ErrorType, MLError}}; 1use crate::{files::{get_downloaded_versions, download_versions, delete_version, disable_version, clean_list_dir}, db::{userlist_get_all_current_versions_with_mods, lists_get_all_ids, lists_get}, modrinth::get_raw_versions, error::{MLE, ErrorType, MLError}};
2use crate::{List, get_current_list, config::Cfg, input::Input}; 2use crate::{List, get_current_list, config::Cfg, input::Input};
3 3
4pub async fn download(config: Cfg, input: Input) -> MLE<()> { 4pub async fn download(config: Cfg, input: Input) -> MLE<()> {
@@ -44,17 +44,10 @@ pub async fn download(config: Cfg, input: Input) -> MLE<()> {
44 } 44 }
45 } 45 }
46 46
47 if input.clean { 47 if input.clean { clean_list_dir(&current_list)? };
48 let dl_path = &current_list.download_folder;
49 println!("Cleaning {}", dl_path);
50 for entry in std::fs::read_dir(dl_path)? {
51 let entry = entry?;
52 std::fs::remove_file(entry.path())?;
53 }
54 }
55 48
56 if !to_download.is_empty() { 49 if !to_download.is_empty() {
57 download_versions(current_list.clone(), get_raw_versions(String::from(&config.apis.modrinth), to_download).await).await?; 50 download_versions(current_list.clone(), config.clone(), get_raw_versions(String::from(&config.apis.modrinth), to_download).await).await?;
58 } else { 51 } else {
59 println!("There are no new versions to download"); 52 println!("There are no new versions to download");
60 } 53 }