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() {