diff --git a/solvers/baronmp/baronmpbackend.cc b/solvers/baronmp/baronmpbackend.cc index f8f01a6d3..4f1a80aee 100644 --- a/solvers/baronmp/baronmpbackend.cc +++ b/solvers/baronmp/baronmpbackend.cc @@ -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"; } diff --git a/solvers/baronmp/baronmpcommon.cc b/solvers/baronmp/baronmpcommon.cc index f5f25da54..67c81f035 100644 --- a/solvers/baronmp/baronmpcommon.cc +++ b/solvers/baronmp/baronmpcommon.cc @@ -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(); } } @@ -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 @@ -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; } }