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