Handle non-existent OTA storage directories
This commit is contained in:
parent
2f8b8aa59f
commit
5857892a4b
@ -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<Vec<OTAUpdate>> {
|
pub fn get_ota_updates_for_platform(platform: OTAPlatform) -> anyhow::Result<Vec<OTAUpdate>> {
|
||||||
let ota_path = AppConfig::get().ota_platform_dir(platform);
|
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();
|
let mut out = Vec::new();
|
||||||
|
|
||||||
for e in std::fs::read_dir(ota_path)? {
|
for e in std::fs::read_dir(ota_path)? {
|
||||||
|
Loading…
Reference in New Issue
Block a user