Skip to content

Commit

Permalink
Fixed crash on WriteDREAM3D xdmf file (BlueQuartzSoftware#921)
Browse files Browse the repository at this point in the history
* Avoids crashing when writing the xdmf file fails
* Reports an error message through the WriteDREAM3DFilter

fixes BlueQuartzSoftware#915
  • Loading branch information
mmarineBlueQuartz authored and imikejackson committed Apr 19, 2024
1 parent 51c4ab9 commit 4eab3a1
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,13 @@ Result<> WriteDREAM3DFilter::executeImpl(DataStructure& dataStructure, const Arg
if(writeXdmf)
{
fs::path xdmfFilePath = exportFilePath.replace_extension(".xdmf");
fs::rename(xdmfFilePath, args.value<fs::path>(k_ExportFilePath).replace_extension(".xdmf"));
std::error_code errorCode;
fs::rename(xdmfFilePath, args.value<fs::path>(k_ExportFilePath).replace_extension(".xdmf"), errorCode);
if(errorCode)
{
std::string ss = fmt::format("Failed to rename xdmf file with error: '{}'", errorCode.message());
return MakeErrorResult(errorCode.value(), ss);
}
}
}
return results;
Expand Down

0 comments on commit 4eab3a1

Please sign in to comment.