From f62d48eb6392d64c6b6a082025c35a36a0fec3aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B0=D1=84=D0=B8=D0=BA=D0=BE=D0=B2=20=D0=90=D0=B9?= =?UTF-8?q?=D1=80=D0=B0=D1=82?= Date: Sun, 13 Oct 2024 22:28:56 +0500 Subject: [PATCH] Background image update fix --- src/background.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/background.rs b/src/background.rs index ab5525d..fa2131d 100644 --- a/src/background.rs +++ b/src/background.rs @@ -65,6 +65,7 @@ pub fn download_background() -> anyhow::Result<()> { let info = get_background_info()?; let mut download_image = true; + let mut replace_cached_image = false; if crate::BACKGROUND_FILE.exists() { let hash = Md5::digest(std::fs::read(crate::BACKGROUND_FILE.as_path())?); @@ -84,6 +85,8 @@ pub fn download_background() -> anyhow::Result<()> { if let Err(err) = downloader.download(crate::BACKGROUND_FILE.as_path(), |_, _| {}) { anyhow::bail!(err); } + + replace_cached_image = true; } // Workaround for GTK weakness @@ -98,7 +101,7 @@ pub fn download_background() -> anyhow::Result<()> { // If it failed to re-code the file - just copy it // Will happen with HSR because devs apparently named // their background image ".webp" while it's JPEG - if !crate::PROCESSED_BACKGROUND_FILE.exists() { + if replace_cached_image || !crate::PROCESSED_BACKGROUND_FILE.exists() { std::fs::copy(crate::BACKGROUND_FILE.as_path(), crate::PROCESSED_BACKGROUND_FILE.as_path())?; } }