From 35303e461fd1301da5cdf43bf6b4eaad00f25208 Mon Sep 17 00:00:00 2001 From: abdoulbari zaher <32519851+a-zakir@users.noreply.github.com> Date: Mon, 10 Jun 2024 16:02:34 +0200 Subject: [PATCH] fix truncated xpress path on linux (#842) --- src/cpp/multisolver_interface/environment.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/cpp/multisolver_interface/environment.cc b/src/cpp/multisolver_interface/environment.cc index dd7063680..b8e65003f 100644 --- a/src/cpp/multisolver_interface/environment.cc +++ b/src/cpp/multisolver_interface/environment.cc @@ -21,7 +21,6 @@ #include #include -#include "StringManip.h" namespace LoadXpress { #define STRINGIFY2(X) #X @@ -231,6 +230,8 @@ std::string XpressLoader::GetXpressVarFromEnvironmentVariables( // Get the value of the LIB environment variable. getenv_s(&requiredSize, xpress_home_from_env.data(), requiredSize, XPRESS_var); + xpress_home_from_env = xpress_home_from_env.substr(0, requiredSize - 1); + } else { if (verbose) { msg.str(""); @@ -246,11 +247,7 @@ std::string XpressLoader::GetXpressVarFromEnvironmentVariables( xpress_home_from_env = path; } #endif - if (auto env_var_size = xpress_home_from_env.size(); env_var_size > 0) { - return xpress_home_from_env.substr(0, env_var_size - 1); - } else { - xpress_home_from_env; - } + return xpress_home_from_env; } std::vector XpressLoader::XpressDynamicLibraryPotentialPaths() {