eclbasevanguard: change canonicalDeckPath to std::string

makes use of filesystem an implementation detail
This commit is contained in:
Arne Morten Kvarving
2021-05-04 08:56:41 +02:00
parent ec2327d2c3
commit 86bc095e3a
3 changed files with 6 additions and 6 deletions

View File

@@ -64,7 +64,7 @@ std::string ebosBlackOilGetDeckFileName(int argc, char** argv)
/*allowUnused=*/true,
/*handleHelp=*/false);
std::string rawDeckFileName = EWOMS_GET_PARAM(ProblemTypeTag, std::string, EclDeckFileName);
std::string result = Vanguard::canonicalDeckPath(rawDeckFileName).string();
std::string result = Vanguard::canonicalDeckPath(rawDeckFileName);
Parameters::reset<ProblemTypeTag>();
return result;

View File

@@ -252,7 +252,7 @@ public:
* The input can either be the canonical deck file name or the name of the case
* (i.e., without the .DATA extension)
*/
static filesystem::path canonicalDeckPath(const std::string& caseName)
static std::string canonicalDeckPath(const std::string& caseName)
{
const auto fileExists = [](const filesystem::path& f) -> bool
{
@@ -267,11 +267,11 @@ public:
auto simcase = filesystem::path(caseName);
if (fileExists(simcase))
return simcase;
return simcase.string();
for (const auto& ext : { std::string("data"), std::string("DATA") }) {
if (fileExists(simcase.replace_extension(ext)))
return simcase;
return simcase.string();
}
throw std::invalid_argument("Cannot find input case '"+caseName+"'");
@@ -386,7 +386,7 @@ public:
throw std::runtime_error("No input deck file has been specified as a command line argument,"
" or via '--ecl-deck-file-name=CASE.DATA'");
fileName = canonicalDeckPath(fileName).string();
fileName = canonicalDeckPath(fileName);
// compute the base name of the input file name
const char directorySeparator = '/';

View File

@@ -414,7 +414,7 @@ namespace Opm
using PreVanguard = GetPropType<PreTypeTag, Properties::Vanguard>;
try {
deckFilename = PreVanguard::canonicalDeckPath(deckFilename).string();
deckFilename = PreVanguard::canonicalDeckPath(deckFilename);
}
catch (const std::exception& e) {
if ( mpiRank == 0 ) {