diff options
author | FxQnLr <[email protected]> | 2022-12-03 20:08:42 +0100 |
---|---|---|
committer | FxQnLr <[email protected]> | 2022-12-03 20:08:42 +0100 |
commit | f3f746be6c1c19c93d440bbc210dec631e2b42bb (patch) | |
tree | 562531a2929cc5f58f449652220a0abe94a0dec7 /src/files.rs | |
parent | 575d2493e8e5747bf65321f7277e52211d73e387 (diff) | |
download | modlist-f3f746be6c1c19c93d440bbc210dec631e2b42bb.tar modlist-f3f746be6c1c19c93d440bbc210dec631e2b42bb.tar.gz modlist-f3f746be6c1c19c93d440bbc210dec631e2b42bb.zip |
remove mod start
Diffstat (limited to 'src/files.rs')
-rw-r--r-- | src/files.rs | 10 |
1 files changed, 9 insertions, 1 deletions
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 @@ | |||
1 | use std::{fs::{File, read_dir}, io::Write, collections::HashMap}; | 1 | use std::{fs::{File, read_dir, remove_file}, io::Write, collections::HashMap}; |
2 | use futures_util::StreamExt; | 2 | use futures_util::StreamExt; |
3 | use reqwest::Client; | 3 | use reqwest::Client; |
4 | 4 | ||
@@ -24,6 +24,14 @@ pub async fn download_file(url: String, path: String, name: String) -> Result<() | |||
24 | Ok(()) | 24 | Ok(()) |
25 | } | 25 | } |
26 | 26 | ||
27 | pub fn delete_version(list: List, version: String) -> Result<(), Box<dyn std::error::Error>> { | ||
28 | let file = get_file_path(list, version)?; | ||
29 | |||
30 | remove_file(file)?; | ||
31 | |||
32 | Ok(()) | ||
33 | } | ||
34 | |||
27 | pub fn get_file_path(list: List, versionid: String) -> Result<String, Box<dyn std::error::Error>> { | 35 | pub fn get_file_path(list: List, versionid: String) -> Result<String, Box<dyn std::error::Error>> { |
28 | let mut names: HashMap<String, String> = HashMap::new(); | 36 | let mut names: HashMap<String, String> = HashMap::new(); |
29 | for file in read_dir(list.download_folder)? { | 37 | for file in read_dir(list.download_folder)? { |