Skip to content

Commit

Permalink
Baron fixes for clang compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
mapgccv committed Nov 4, 2024
1 parent 1aaf5d1 commit 3db61b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 9 additions & 3 deletions solvers/baronmp/baronmpbackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,16 @@ void BaronmpBackend::OpenSolver() {
"Failed to create problem, error code {}.", status ) );
}


void BaronmpBackend::CloseSolver() {
if((!baronDir.empty()) && (!baronOptions().keepsol))
recrmdir(baronDir);
}
if(!baronDir.empty())
{
if(baronOptions().keepsol)
fmt::print("Keeping temporary files in {}\n", baronDir);
else
recrmdir(baronDir);
}
}

const char* BaronmpBackend::GetBackendName()
{ return "BaronmpBackend"; }
Expand Down
8 changes: 5 additions & 3 deletions solvers/baronmp/baronmpcommon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ void BaronmpCommon::initDirectories(const std::string& stub,
}
if (!fs::exists(scratch_path)) {
if (fs::create_directory(scratch_path)) {
baronDir = scratch;
baronDir = scratch_path.string();
}
}
else if (fs::is_directory(scratch_path)) {
td = scratch;
td = scratch_path.string();
}
}

Expand Down Expand Up @@ -241,6 +241,9 @@ void BaronmpCommon::initDirectories(const std::string& stub,

// Construct nlfile path based on whether stub is absolute or relative
fs::path nlfile_path;
#ifndef WIN32
nlfile_path = resolveTilde(nlfile_path);
#endif
if (fs::path(stub).is_absolute()
#ifdef _WIN32
|| (stub.size() > 1 && stub[1] == ':') // Also handle drive letter case on Windows
Expand Down Expand Up @@ -278,7 +281,6 @@ int BaronmpCommon::recrmdir(const std::string& dname) {
return 0; // Success
}
else {
fmt::print(stderr, "recrmdir: \"{}\" is not a directory.\n", dname);
return 0;
}
}
Expand Down

0 comments on commit 3db61b3

Please sign in to comment.