Mass: improve reliability of staged builds.
This commit is contained in:
parent
0da7de19fc
commit
871a750f66
1 changed files with 4 additions and 18 deletions
|
@ -56,28 +56,14 @@ Mass::getNameFromFile(Containers::StringView path) {
|
||||||
return Containers::NullOpt;
|
return Containers::NullOpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gvas::File mass{path};
|
Mass mass{path};
|
||||||
|
|
||||||
if(!mass.valid()) {
|
if(mass._state != State::Valid) {
|
||||||
LOG_ERROR_FORMAT("{} is invalid: {}", path, mass.lastError());
|
LOG_ERROR_FORMAT("{} is invalid: {}", path, mass._lastError);
|
||||||
return Containers::NullOpt;
|
return Containers::NullOpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto unit_data = mass.at<Gvas::Types::GenericStructProperty>(MASS_UNIT_DATA);
|
return mass._name;
|
||||||
|
|
||||||
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};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue