diff options
| author | 2025-01-11 15:22:09 -0600 | |
|---|---|---|
| committer | 2025-01-11 15:22:09 -0600 | |
| commit | 04476beb75b9408d58b40b2f86092d128d325736 (patch) | |
| tree | bc43b411f94dd176f643033a7c986376a2878df0 /src/launcher.rs | |
| parent | implement basic downloader (diff) | |
use a macro for map_err
Diffstat (limited to 'src/launcher.rs')
| -rw-r--r-- | src/launcher.rs | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/launcher.rs b/src/launcher.rs index 98a8020..e207281 100644 --- a/src/launcher.rs +++ b/src/launcher.rs @@ -195,41 +195,6 @@ impl LibraryRepository { p.push(Self::get_artifact_filename(name, classifier)?); Some(p) } - - async fn should_redownload(&self, lib: &Library, classifier: Option<&str>) -> Result<bool, LibraryError> { - let path = Self::get_artifact_path(lib.name.as_str(), classifier) - .map_or_else(|| Err(LibraryError::InvalidName(lib.name.clone())), |p| Ok(p))?; - - let mut f = match File::open(path).await { - Ok(f) => f, - Err(e) => return match e.kind() { - ErrorKind::NotFound => Ok(true), - e => Err(LibraryError::IOError(e)) - } - }; - - let mut data = [0u8; 4096]; - let mut sha1 = Sha1::new(); - - loop { - let n = match f.read(&mut data).await { - Ok(n) => n, - Err(e) => return match e.kind() { - ErrorKind::Interrupted => continue, - kind => Err(LibraryError::IOError(kind)) - } - }; - - if n == 0 { - break; // we reached the end of the file - } - - sha1.update(&data[..n]); - } - - - todo!() - } } impl SystemInfo { |
