From e9e031992a92eed50f717e9d54bb4dc58ae6d530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Gunics?= Date: Tue, 30 Dec 2025 12:20:46 +0100 Subject: [PATCH] Fix the DDOP filename generation. Some implements have the "no more text" ASCII character in their name. Also the extension should be .ddop not .iop (cherry picked from commit 01d2bc0807b99aaefb7ea59ba0a39a6694e7039a) --- src/task_controller.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/task_controller.cpp b/src/task_controller.cpp index 4ee92bb..72a0567 100644 --- a/src/task_controller.cpp +++ b/src/task_controller.cpp @@ -271,7 +271,14 @@ bool MyTCServer::activate_object_pool(std::shared_ptr p break; } } - auto fileName = std::to_string(partnerCF->get_NAME().get_full_name()) + "\\" + std::string(deviceObject->get_localization_label().begin(), deviceObject->get_localization_label().end()) + ".iop"; + + auto labelBytes = deviceObject->get_localization_label(); + std::string label(reinterpret_cast(labelBytes.data()), labelBytes.size()); + // trim at first occurrence of null or ETX (0x03) + auto it = std::find_if(label.begin(), label.end(), [](char c) { return c == '\0' || static_cast(c) == 0x03; }); + label.erase(it, label.end()); + + auto fileName = std::to_string(partnerCF->get_NAME().get_full_name()) + "\\" + label + ".ddop"; std::vector binaryPool; if (state.get_pool().generate_binary_object_pool(binaryPool)) { @@ -280,10 +287,11 @@ bool MyTCServer::activate_object_pool(std::shared_ptr p { outFile.write(reinterpret_cast(binaryPool.data()), binaryPool.size()); outFile.close(); + std::cout << "Saved DDOP to file: " << fileName << std::endl; } else { - std::cout << "Unable to save DDOP to NVM. (Failed to open file)" << std::endl; + std::cout << "Unable to save DDOP to NVM. (Failed to open file) file: " << fileName << std::endl; } } else