summaryrefslogtreecommitdiff
path: root/src/files.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2023-01-19 18:37:42 +0100
committerfxqnlr <[email protected]>2023-01-19 18:37:42 +0100
commitf7a6d2e9c67c1fdf8fc17fa0461a201fd2720537 (patch)
tree21d0c7356b55e9b45517fd9ca874dd3270b6bc3a /src/files.rs
parentbe9f74f4fb82b25abd99f7024e0f5eea2691f34f (diff)
downloadmodlist-f7a6d2e9c67c1fdf8fc17fa0461a201fd2720537.tar
modlist-f7a6d2e9c67c1fdf8fc17fa0461a201fd2720537.tar.gz
modlist-f7a6d2e9c67c1fdf8fc17fa0461a201fd2720537.zip
input mostly inplemented, mods missing
Diffstat (limited to 'src/files.rs')
-rw-r--r--src/files.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/files.rs b/src/files.rs
index 998ed32..14e5636 100644
--- a/src/files.rs
+++ b/src/files.rs
@@ -85,12 +85,12 @@ pub fn get_file_path(list: List, versionid: String) -> MLE<String> {
85 Ok(filename.to_owned()) 85 Ok(filename.to_owned())
86} 86}
87 87
88pub fn get_downloaded_versions(list: List) -> Result<HashMap<String, String>, Box<dyn std::error::Error>> { 88pub fn get_downloaded_versions(list: List) -> MLE<HashMap<String, String>> {
89 let mut versions: HashMap<String, String> = HashMap::new(); 89 let mut versions: HashMap<String, String> = HashMap::new();
90 for file in read_dir(&list.download_folder)? { 90 for file in read_dir(&list.download_folder)? {
91 let path = file?.path(); 91 let path = file?.path();
92 if path.is_file() && path.extension().ok_or("BAH")? == "jar" { 92 if path.is_file() && path.extension().ok_or("BAH").unwrap() == "jar" {
93 let pathstr = path.to_str().ok_or("BAH")?; 93 let pathstr = path.to_str().ok_or("BAH").unwrap();
94 let namesplit: Vec<&str> = pathstr.split('.').collect(); 94 let namesplit: Vec<&str> = pathstr.split('.').collect();
95 versions.insert(String::from(namesplit[namesplit.len() - 3]), String::from(namesplit[namesplit.len() - 2])); 95 versions.insert(String::from(namesplit[namesplit.len() - 3]), String::from(namesplit[namesplit.len() - 2]));
96 } 96 }