From 1c8964441432047eaa2e866666c4055b35b55253 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Fri, 9 Dec 2022 20:30:10 +0100 Subject: added download with delete; new file format --- src/commands/update.rs | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) (limited to 'src/commands/update.rs') diff --git a/src/commands/update.rs b/src/commands/update.rs index eeb5a4d..498b6a9 100644 --- a/src/commands/update.rs +++ b/src/commands/update.rs @@ -1,6 +1,6 @@ -use std::{io::{Error, ErrorKind}, fs::rename}; +use std::io::{Error, ErrorKind}; -use crate::{config::Cfg, modrinth::{projects, Project, versions, extract_current_version, Version}, get_current_list, db::{userlist_get_all_ids, mods_get_versions, userlist_get_applicable_versions, userlist_change_versions, lists_get_all_ids, lists_get, userlist_get_current_version, userlist_add_disabled_versions, mods_change_versions}, List, input::Input, files::{get_file_path, delete_version, download_versions}}; +use crate::{config::Cfg, modrinth::{projects, Project, versions, extract_current_version, Version}, get_current_list, db::{userlist_get_all_ids, mods_get_versions, userlist_get_applicable_versions, userlist_change_versions, lists_get_all_ids, lists_get, userlist_get_current_version, mods_change_versions}, List, input::Input, files::{delete_version, download_versions, disable_version}}; pub async fn update(config: Cfg, input: Input) -> Result<(), Box> { @@ -69,18 +69,21 @@ pub async fn update(config: Cfg, input: Input) -> Result<(), Box Result<(), Box> { - println!("Disabling version {} for mod {}", versionid, mod_id); - let file = get_file_path(current_list.clone(), String::from(&versionid))?; - let disabled = format!("{}.disabled", file); - - rename(file, disabled)?; - - userlist_add_disabled_versions(config, current_list.id, versionid, mod_id)?; - - Ok(()) -} - #[tokio::test] async fn download_updates_test() { -- cgit v1.2.3