ENH: report API information in header #2126

- previously reported the WM_PROJECT_VERSION in the top banner
  but this makes it overly sensitive to arbitrary user naming.

  Change to the current API in the comment banner, include the
  WM_PROJECT_VERSION as part of the reported "Build: ..."
  string instead.
This commit is contained in:
Mark Olesen 2021-06-17 12:21:24 +02:00
parent d379f0b61d
commit 270f2eecf9
2 changed files with 6 additions and 2 deletions

View File

@ -83,14 +83,16 @@ Foam::IOobject::writeBanner(Ostream& os, const bool noSyntaxHint)
{ {
// Populate: like strncpy but without trailing '\0' // Populate: like strncpy but without trailing '\0'
std::size_t len = foamVersion::version.length(); const std::string apiValue(std::to_string(Foam::foamVersion::api));
std::size_t len = apiValue.length();
if (len > 38) if (len > 38)
{ {
len = 38; len = 38;
} }
std::memset(paddedVersion, ' ', 38); std::memset(paddedVersion, ' ', 38);
std::memcpy(paddedVersion, foamVersion::version.c_str(), len); std::memcpy(paddedVersion, apiValue.c_str(), len);
paddedVersion[38] = '\0'; paddedVersion[38] = '\0';
} }

View File

@ -1036,6 +1036,8 @@ void Foam::argList::parse
Info<< " patch=" << foamVersion::patch.c_str(); Info<< " patch=" << foamVersion::patch.c_str();
} }
Info<< " version=" << foamVersion::version.c_str();
Info<< nl Info<< nl
<< "Arch : " << foamVersion::buildArch << nl << "Arch : " << foamVersion::buildArch << nl
<< "Exec : " << commandLine_.c_str() << nl << "Exec : " << commandLine_.c_str() << nl