add function to print information about available compressions tools
This commit is contained in:
@ -418,6 +418,24 @@ std::string platform::mpi_info(int &major, int &minor)
|
||||
return {version};
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
collect available compression tool info
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
std::string platform::compress_info()
|
||||
{
|
||||
std::string buf = "Available compression formats:\n\n";
|
||||
bool none_found = true;
|
||||
for (const auto &cmpi : compress_styles) {
|
||||
if (cmpi.style == ::compress_info::NONE) continue;
|
||||
if (find_exe_path(cmpi.command).size()) {
|
||||
none_found = false;
|
||||
buf += fmt::format("Extension: .{:6} Command: {}\n", cmpi.extension, cmpi.command);
|
||||
}
|
||||
}
|
||||
if (none_found) buf += "None\n";
|
||||
return buf;
|
||||
}
|
||||
/* ----------------------------------------------------------------------
|
||||
set environment variable
|
||||
------------------------------------------------------------------------- */
|
||||
@ -930,7 +948,7 @@ bool platform::file_is_readable(const std::string &path)
|
||||
|
||||
bool platform::has_compress_extension(const std::string &file)
|
||||
{
|
||||
return find_compress_type(file).style != compress_info::NONE;
|
||||
return find_compress_type(file).style != ::compress_info::NONE;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -943,7 +961,7 @@ FILE *platform::compressed_read(const std::string &file)
|
||||
|
||||
#if defined(LAMMPS_GZIP)
|
||||
auto compress = find_compress_type(file);
|
||||
if (compress.style == compress_info::NONE) return nullptr;
|
||||
if (compress.style == ::compress_info::NONE) return nullptr;
|
||||
|
||||
if (find_exe_path(compress.command).size())
|
||||
// put quotes around file name so that they may contain blanks
|
||||
@ -962,7 +980,7 @@ FILE *platform::compressed_write(const std::string &file)
|
||||
|
||||
#if defined(LAMMPS_GZIP)
|
||||
auto compress = find_compress_type(file);
|
||||
if (compress.style == compress_info::NONE) return nullptr;
|
||||
if (compress.style == ::compress_info::NONE) return nullptr;
|
||||
|
||||
if (find_exe_path(compress.command).size())
|
||||
// put quotes around file name so that they may contain blanks
|
||||
|
||||
Reference in New Issue
Block a user