From f3f746be6c1c19c93d440bbc210dec631e2b42bb Mon Sep 17 00:00:00 2001 From: FxQnLr Date: Sat, 3 Dec 2022 20:08:42 +0100 Subject: remove mod start --- src/files.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/files.rs') diff --git a/src/files.rs b/src/files.rs index 1c0b13c..2c5994d 100644 --- a/src/files.rs +++ b/src/files.rs @@ -1,4 +1,4 @@ -use std::{fs::{File, read_dir}, io::Write, collections::HashMap}; +use std::{fs::{File, read_dir, remove_file}, io::Write, collections::HashMap}; use futures_util::StreamExt; use reqwest::Client; @@ -24,6 +24,14 @@ pub async fn download_file(url: String, path: String, name: String) -> Result<() Ok(()) } +pub fn delete_version(list: List, version: String) -> Result<(), Box> { + let file = get_file_path(list, version)?; + + remove_file(file)?; + + Ok(()) +} + pub fn get_file_path(list: List, versionid: String) -> Result> { let mut names: HashMap = HashMap::new(); for file in read_dir(list.download_folder)? { -- cgit v1.2.3