From 3d8ef7a5713e761d9c6e752d179586006af4963b Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Thu, 9 Nov 2023 15:27:20 +0100 Subject: [PATCH] download_sysext: skip checking for downloads if that does not exist We need to skip checking for existing downloads, if the file does not exist. Otherwise, check_download will simply fail in the beginning, due to missing files. --- src/bin/download_sysext.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bin/download_sysext.rs b/src/bin/download_sysext.rs index 096b857..bf610a6 100644 --- a/src/bin/download_sysext.rs +++ b/src/bin/download_sysext.rs @@ -67,6 +67,13 @@ impl<'a> Package<'a> { #[rustfmt::skip] fn check_download(&mut self, in_dir: &Path) -> Result<(), Box> { let path = in_dir.join(&*self.name); + + if !path.exists() { + // skip checking for existing downloads + info!("{} does not exist, skipping existing downloads.", path.display()); + return Ok(()); + } + let md = fs::metadata(&path)?; let size_on_disk = md.len() as usize;