Merge pull request #1567 from blattms/tighten-regex-for-parallel-output

Let ParallelFileMerger only warn about CASENAME.[0-9]*.EXT files.
This commit is contained in:
Bård Skaflestad 2018-09-12 12:21:47 +02:00 committed by GitHub
commit c3de357f30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,7 +50,8 @@ public:
ParallelFileMerger(const fs::path& output_dir,
const std::string& deckname)
: debugFileRegex_(deckname+"\\.\\d+\\.DBG"),
logFileRegex_(deckname+"\\.\\d+\\.PRT")
logFileRegex_(deckname+"\\.\\d+\\.PRT"),
fileWarningRegex_(deckname+"\\.(\\d+)\\.[^.]+")
{
auto debugPath = output_dir;
debugPath /= (deckname + ".DBG");
@ -64,13 +65,12 @@ public:
void operator()(const fs::path& file)
{
const static boost::regex regex(".+\\.(\\d+)\\..+");
boost::smatch matches;
std::string filename = file.filename().native();
if ( boost::regex_match(filename, matches, regex) )
if ( boost::regex_match(filename, matches, fileWarningRegex_) )
{
std::string rank = boost::regex_replace(filename, regex, "\\1");
std::string rank = boost::regex_replace(filename, fileWarningRegex_, "\\1");
if( boost::regex_match(filename, logFileRegex_) )
{
@ -123,6 +123,8 @@ private:
boost::regex debugFileRegex_;
/// \brief Regex to capture *.PRT
boost::regex logFileRegex_;
/// \brief Regex to capture CASENAME.[0-9]+.[A-Z]+
boost::regex fileWarningRegex_;
/// \brief Stream to *.DBG file
std::unique_ptr<fs::ofstream> debugStream_;
/// \brief Stream to *.PRT file