[bugfix] Only strip ".DATA" or "." extensions.

As there might models named MODEL.01.DATA for which a call
"flow MODEL.01" would have stripped the extension.
This commit is contained in:
Markus Blatt 2019-01-16 11:58:47 +01:00
parent 20d12f5b53
commit 4f4f5cbca3

View File

@ -326,8 +326,16 @@ namespace Opm
std::ostringstream debugFileStream;
std::ostringstream logFileStream;
// Strip extension if any
baseName = boost::to_upper_copy(path(fpath.stem()).string());
// Strip extension "." or ".DATA"
std::string extension = boost::to_upper_copy(fpath.extension().string());
if ( extension == ".DATA" || extension == "." )
{
baseName = boost::to_upper_copy(fpath.stem().string());
}
else
{
baseName = boost::to_upper_copy(fpath.filename().string());
}
const std::string& output_dir = eclState().getIOConfig().getOutputDir();
logFileStream << output_dir << "/" << baseName;
@ -427,7 +435,17 @@ namespace Opm
const std::string& output_dir = eclState().getIOConfig().getOutputDir();
fs::path output_path(output_dir);
fs::path deck_filename(EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName));
std::string basename = boost::to_upper_copy(fs::path(deck_filename).stem().string());
std::string basename;
// Strip extension "." and ".DATA"
std::string extension = boost::to_upper_copy(deck_filename.extension().string());
if ( extension == ".DATA" || extension == "." )
{
basename = boost::to_upper_copy(deck_filename.stem().string());
}
else
{
basename = boost::to_upper_copy(deck_filename.filename().string());
}
std::for_each(fs::directory_iterator(output_path),
fs::directory_iterator(),
detail::ParallelFileMerger(output_path, basename,