Build viewer/editor #13
1 changed files with 7 additions and 0 deletions
|
@ -61,6 +61,7 @@ auto UESaveFile::saveToFile() -> bool {
|
|||
BinaryWriter writer{_filepath + ".tmp"};
|
||||
|
||||
if(!writer.open()) {
|
||||
_lastError = "Couldn't open the file for saving.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -73,12 +74,14 @@ auto UESaveFile::saveToFile() -> bool {
|
|||
!writer.writeUnsignedInt(_engineVersion.build) ||
|
||||
!writer.writeUEString(_engineVersion.buildId))
|
||||
{
|
||||
_lastError = "Couldn't write the header.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!writer.writeUnsignedInt(_customFormatVersion) ||
|
||||
!writer.writeUnsignedInt(_customFormatData.size()))
|
||||
{
|
||||
_lastError = "Couldn't write the header.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -86,21 +89,25 @@ auto UESaveFile::saveToFile() -> bool {
|
|||
if(!writer.writeStaticArray(Containers::StaticArrayView<16, const char>{_customFormatData[i].id}) ||
|
||||
!writer.writeUnsignedInt(_customFormatData[i].value))
|
||||
{
|
||||
_lastError = "Couldn't write the header.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!writer.writeUEString(_saveType)) {
|
||||
_lastError = "Couldn't write the header.";
|
||||
return false;
|
||||
}
|
||||
|
||||
for(auto& prop : _properties) {
|
||||
UnsignedLong bytes_written = 0;
|
||||
if(!_propSerialiser.write(prop, bytes_written, writer)) {
|
||||
_lastError = "Couldn't write the property " + *prop->name + " to the array.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!writer.flushToFile()) {
|
||||
_lastError = "Couldn't write the property " + *prop->name + " to the file.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue