revive skipped code to detect OS revisions

This commit is contained in:
Axel Kohlmeyer
2021-10-05 22:30:45 -04:00
parent 6f2076a9b8
commit 087c1b3a65

View File

@ -16,6 +16,7 @@
* the "utils" namespace with convenience and utility functions. */ * the "utils" namespace with convenience and utility functions. */
#include "platform.h" #include "platform.h"
#include "text_file_reader.h"
#include "utils.h" #include "utils.h"
#if HAVE_MPI #if HAVE_MPI
@ -227,14 +228,13 @@ std::string platform::os_info()
// try to get OS distribution name, if available // try to get OS distribution name, if available
buf = ut.sysname; buf = ut.sysname;
#if 0 // disable until this is integrated into LAMMPS and TextFileReader becomes available
if (platform::file_is_readable("/etc/os-release")) { if (platform::file_is_readable("/etc/os-release")) {
try { try {
TextFileReader reader("/etc/os-release",""); TextFileReader reader("/etc/os-release","");
while (1) { while (1) {
auto words = reader.next_values(0,"="); auto words = reader.next_values(0,"=");
if ((words.count() > 1) && (words.next_string() == "PRETTY_NAME")) { if ((words.count() > 1) && (words.next_string() == "PRETTY_NAME")) {
distro += " " + utils::trim(words.next_string()); buf += " " + utils::trim(words.next_string());
break; break;
} }
} }
@ -242,7 +242,6 @@ std::string platform::os_info()
; // EOF but keyword not found ; // EOF but keyword not found
} }
} }
#endif
buf += std::string(" ") + ut.release + " " + ut.machine; buf += std::string(" ") + ut.release + " " + ut.machine;
#endif #endif