From 5857892a4b17d21c5089225fd7048b2e8f9c1c5c Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 12 Oct 2024 16:42:01 +0200 Subject: [PATCH] Handle non-existent OTA storage directories --- central_backend/src/ota/ota_manager.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/central_backend/src/ota/ota_manager.rs b/central_backend/src/ota/ota_manager.rs index f9c713d..c4fb257 100644 --- a/central_backend/src/ota/ota_manager.rs +++ b/central_backend/src/ota/ota_manager.rs @@ -42,6 +42,11 @@ pub fn delete_update(platform: OTAPlatform, version: &semver::Version) -> anyhow pub fn get_ota_updates_for_platform(platform: OTAPlatform) -> anyhow::Result> { let ota_path = AppConfig::get().ota_platform_dir(platform); + // Check if the directory dedicated to the updates of the platform exists + if !ota_path.is_dir() { + return Ok(Vec::new()); + } + let mut out = Vec::new(); for e in std::fs::read_dir(ota_path)? {