Skip to content

Commit 3db61b3

Browse files
committed
Baron fixes for clang compilation
1 parent 1aaf5d1 commit 3db61b3

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

solvers/baronmp/baronmpbackend.cc

+9-3
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,16 @@ void BaronmpBackend::OpenSolver() {
7575
"Failed to create problem, error code {}.", status ) );
7676
}
7777

78+
7879
void BaronmpBackend::CloseSolver() {
79-
if((!baronDir.empty()) && (!baronOptions().keepsol))
80-
recrmdir(baronDir);
81-
}
80+
if(!baronDir.empty())
81+
{
82+
if(baronOptions().keepsol)
83+
fmt::print("Keeping temporary files in {}\n", baronDir);
84+
else
85+
recrmdir(baronDir);
86+
}
87+
}
8288

8389
const char* BaronmpBackend::GetBackendName()
8490
{ return "BaronmpBackend"; }

solvers/baronmp/baronmpcommon.cc

+5-3
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ void BaronmpCommon::initDirectories(const std::string& stub,
208208
}
209209
if (!fs::exists(scratch_path)) {
210210
if (fs::create_directory(scratch_path)) {
211-
baronDir = scratch;
211+
baronDir = scratch_path.string();
212212
}
213213
}
214214
else if (fs::is_directory(scratch_path)) {
215-
td = scratch;
215+
td = scratch_path.string();
216216
}
217217
}
218218

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

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

0 commit comments

Comments
 (0)