Fix to reduce errors when opening gps config

This commit is contained in:
Ken Van Hoeylandt 2025-08-01 19:52:17 +02:00
parent 2d0b78d497
commit 214a402368

View File

@ -30,6 +30,13 @@ bool GpsService::getGpsConfigurations(std::vector<hal::gps::GpsConfiguration>& c
return false;
}
// If file does not exist, return empty list
if (access(path.c_str(), F_OK) != 0) {
TT_LOG_W(TAG, "No configurations (file not found: %s)", path.c_str());
return true;
}
TT_LOG_I(TAG, "Reading configuration file %s", path.c_str());
auto reader = file::ObjectFileReader(path, sizeof(hal::gps::GpsConfiguration));
if (!reader.open()) {
TT_LOG_E(TAG, "Failed to open configuration file");