Skip to content

Commit

Permalink
fix truncated xpress path on linux (#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zakir authored Jun 10, 2024
1 parent d257607 commit 35303e4
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/cpp/multisolver_interface/environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <sstream>
#include <string>

#include "StringManip.h"
namespace LoadXpress {

#define STRINGIFY2(X) #X
Expand Down Expand Up @@ -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("");
Expand All @@ -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<std::string> XpressLoader::XpressDynamicLibraryPotentialPaths() {
Expand Down

0 comments on commit 35303e4

Please sign in to comment.