From 0c939939aa84c0ee1bf0a3d5844777cd51e3572c Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Fri, 6 May 2022 17:20:37 +0200 Subject: [PATCH 1/4] Drop trailing \0 characters in value returned by iCubModels::getModelsPath function --- cpp/src/iCubModels.cpp.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cpp/src/iCubModels.cpp.in b/cpp/src/iCubModels.cpp.in index 1820ec4..c5d6ccc 100644 --- a/cpp/src/iCubModels.cpp.in +++ b/cpp/src/iCubModels.cpp.in @@ -12,6 +12,11 @@ namespace iCubModels std::string getModelsPath() { std::string retstr = "@ICUB_MODELS_MODELS_PATH@"; + // Sometimes the relocation of the C++ library in conda or similar systems is not working correctly + // and is leaving at the end of the retstr many \0 characters. To be sure not to return a faulty + // string, we remove all the trailing \0 + // See https://github.com/ami-iit/bipedal-locomotion-framework/pull/526 + retstr.erase(std::find(retstr.begin(), retstr.end(), '\0'), retstr.end()); return retstr; } From 62612560e8f1061bb57dd683e7124019b8bead06 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Fri, 6 May 2022 17:24:58 +0200 Subject: [PATCH 2/4] Update iCubModels.cpp.in --- cpp/src/iCubModels.cpp.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpp/src/iCubModels.cpp.in b/cpp/src/iCubModels.cpp.in index c5d6ccc..13c4cdd 100644 --- a/cpp/src/iCubModels.cpp.in +++ b/cpp/src/iCubModels.cpp.in @@ -7,6 +7,8 @@ #include +#include + namespace iCubModels { std::string getModelsPath() From 4291fb63b8019b7a71eb40c57ddb2c7771cbc5d1 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Fri, 6 May 2022 17:27:12 +0200 Subject: [PATCH 3/4] Update CMakeLists.txt --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 49bca5b..ce8536c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,11 @@ -# Copyright: (C) 2017 Fondazione Istituto Italiano di Tecnologia +# Copyright: (C) 2022 Fondazione Istituto Italiano di Tecnologia # Authors: Silvio Traversaro # CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT cmake_minimum_required(VERSION 3.8) project(icub-models - VERSION 1.23.3) + VERSION 1.23.4) include(GNUInstallDirs) From ea88144c49f586bde0516062aca88c2308a94bdd Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Fri, 6 May 2022 17:48:52 +0200 Subject: [PATCH 4/4] Update iCubModels.cpp.in --- cpp/src/iCubModels.cpp.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/iCubModels.cpp.in b/cpp/src/iCubModels.cpp.in index 13c4cdd..4e6d5b4 100644 --- a/cpp/src/iCubModels.cpp.in +++ b/cpp/src/iCubModels.cpp.in @@ -37,7 +37,7 @@ std::string getModelFile(const std::string& modelName) return modelFile; } - modelFile = "@ICUB_MODELS_MODELS_PATH@/" + modelName + "/model.urdf"; + modelFile = getModelsPath() + "/" + modelName + "/model.urdf"; return modelFile; } } // namespace iCubModels