mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-18 19:30:25 +00:00
IfcConvert: Show an error msg if renaming from temp to final file fails.
This commit is contained in:
@@ -514,7 +514,12 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
delete serializer;
|
delete serializer;
|
||||||
|
|
||||||
rename_file(output_temp_filename, output_filename);
|
// Renaming might fail (e.g. maybe the existing file was open in a viewer application)
|
||||||
|
// Do not remove the temp file as user can salvage the conversion result from it.
|
||||||
|
bool successful = rename_file(output_temp_filename, output_filename);
|
||||||
|
if (!successful) {
|
||||||
|
Logger::Message(Logger::LOG_ERROR, "Unable to write output file '" + output_filename + "");
|
||||||
|
}
|
||||||
|
|
||||||
if (output_extension == ".obj") {
|
if (output_extension == ".obj") {
|
||||||
std::string mtl_filename = change_extension(output_filename, "mtl");
|
std::string mtl_filename = change_extension(output_filename, "mtl");
|
||||||
@@ -531,7 +536,7 @@ int main(int argc, char** argv) {
|
|||||||
else
|
else
|
||||||
printf("\nConversion took %d minute(s) %d seconds\n", seconds/60, seconds%60); // TODO Logger::Message(Logger::LOG_NOTICE, ...);
|
printf("\nConversion took %d minute(s) %d seconds\n", seconds/60, seconds%60); // TODO Logger::Message(Logger::LOG_NOTICE, ...);
|
||||||
|
|
||||||
return 0;
|
return successful ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_log() {
|
void write_log() {
|
||||||
|
|||||||
Reference in New Issue
Block a user