diff options
| author | 2025-01-22 19:03:31 -0600 | |
|---|---|---|
| committer | 2025-01-22 19:03:31 -0600 | |
| commit | b2edba152d0256a8921f3a25d67a062163a54f59 (patch) | |
| tree | 0bdc8b1ea4fedbb4d18c8347da76884c381b45b9 /src/launcher/download.rs | |
| parent | more jre download stuff (diff) | |
finish downloaded jres
Diffstat (limited to 'src/launcher/download.rs')
| -rw-r--r-- | src/launcher/download.rs | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/launcher/download.rs b/src/launcher/download.rs index 4eedba5..846bed1 100644 --- a/src/launcher/download.rs +++ b/src/launcher/download.rs @@ -215,27 +215,8 @@ impl Download for VerifiedDownload { } async fn prepare(&mut self, req: RequestBuilder) -> Result<Option<RequestBuilder>, Box<dyn Error>> { - match util::verify_file(&self.path, self.expect_size, self.expect_sha1).await { - Ok(()) => { - debug!("Skipping download for file {}, integrity matches.", self.path.display()); - return Ok(None); - }, - Err(e) => match e { - FileVerifyError::Integrity(_, _) => { - warn!("Integrity error on library: {}", e); - - // try to delete the file since it's bad - let _ = fs::remove_file(&self.path).await - .map_err(|e| warn!("Error deleting corrupted/modified file {} (ignoring): {}", self.path.display(), e)); - }, - FileVerifyError::Open(_, e) => match e.kind() { - ErrorKind::NotFound => { - debug!("File {} is missing, downloading it.", self.path.display()); - }, - _ => return Err(e.into()) - }, - _ => return Err(e.into()) - } + if !util::should_download(&self.path, self.expect_size, self.expect_sha1).await? { + return Ok(None) } // potentially racy to close the file and reopen it... :/ |
