Mass: improve reliability of staged builds.

This commit is contained in:
Guillaume Jacquemin 2024-12-06 18:24:10 +01:00
parent 0da7de19fc
commit 871a750f66
Signed by: williamjcm
SSH key fingerprint: SHA256:AYLOg+iTV0ElElnlu4vqM4edFazVdRiuQB0Y5LoKc4A

View file

@ -56,28 +56,14 @@ Mass::getNameFromFile(Containers::StringView path) {
return Containers::NullOpt;
}
Gvas::File mass{path};
Mass mass{path};
if(!mass.valid()) {
LOG_ERROR_FORMAT("{} is invalid: {}", path, mass.lastError());
if(mass._state != State::Valid) {
LOG_ERROR_FORMAT("{} is invalid: {}", path, mass._lastError);
return Containers::NullOpt;
}
auto unit_data = mass.at<Gvas::Types::GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) {
LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, path);
return Containers::NullOpt;
}
auto name_prop = unit_data->at<Gvas::Types::StringProperty>(MASS_NAME);
if(!name_prop) {
LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_NAME, path);
return Containers::NullOpt;
}
return {name_prop->value};
return mass._name;
}
void