IfcConvert: report an error when the output file cannot be opened (#438)

Converting to a path whose directory does not exist (or is not writable)
failed silently: the serializer's ready() check correctly returned false,
but IfcConvert deleted the temp file and returned EXIT_FAILURE without any
message, so the user saw no reason for the failure.

Log a SYS error naming the output file before returning, matching the
existing "Unable to open output file" reporting used elsewhere.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit a0f493b471)
This commit is contained in:
Petru Conduraru
2026-07-10 15:37:44 +03:00
committed by Dion Moult
parent 29a3514aff
commit de64f8e0a2
+1
View File
@@ -785,6 +785,7 @@ int main(int argc, char** argv) {
}
if (!serializer->ready()) {
logger.error("SYS", 25, "Unable to open output file '" + ifcopenshell::path::to_utf8(output_filename) + "' for writing; check that the directory exists and is writable");
ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename));
write_log(!quiet);
return EXIT_FAILURE;