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) diff --git a/cpp/src/iCubModels.cpp.in b/cpp/src/iCubModels.cpp.in index 1820ec4..4e6d5b4 100644 --- a/cpp/src/iCubModels.cpp.in +++ b/cpp/src/iCubModels.cpp.in @@ -7,11 +7,18 @@ #include +#include + 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; } @@ -30,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