feat: handle dwebp re-coding errors

This commit is contained in:
Nikita Podvirnyi 2024-06-17 15:59:00 +02:00
parent d37e0fb7a9
commit d125b27015
No known key found for this signature in database
GPG key ID: 859D416E5142AFF3
2 changed files with 12 additions and 1 deletions

View file

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- Handle dwebp re-coding errors
## [3.10.0] - 17.06.2024
### Added

View file

@ -99,7 +99,14 @@ pub fn download_background() -> anyhow::Result<()> {
.arg("-o")
.arg(crate::BACKGROUND_PRIMARY_FILE.as_path())
.spawn()?
.wait_with_output()?;
.wait()?;
// 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::BACKGROUND_PRIMARY_FILE.exists() {
std::fs::copy(crate::BACKGROUND_FILE.as_path(), crate::BACKGROUND_PRIMARY_FILE.as_path())?;
}
}
else {