From 672b240e0060d0ad64ecc0d8bd72332f7a342769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20Gr=C3=B8n=C3=A5s=20Drange?= Date: Tue, 3 May 2016 14:07:21 +0200 Subject: [PATCH] fixed bug in Parser, use openRootFile --- opm/parser/eclipse/EclipseState/IOConfig/IOConfig.cpp | 2 ++ .../eclipse/EclipseState/tests/EclipseStateTests.cpp | 7 +++++++ opm/parser/eclipse/Parser/Parser.cpp | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/opm/parser/eclipse/EclipseState/IOConfig/IOConfig.cpp b/opm/parser/eclipse/EclipseState/IOConfig/IOConfig.cpp index 8fd7b3ed8..132780361 100644 --- a/opm/parser/eclipse/EclipseState/IOConfig/IOConfig.cpp +++ b/opm/parser/eclipse/EclipseState/IOConfig/IOConfig.cpp @@ -57,6 +57,8 @@ namespace Opm { boost::filesystem::path path( input_path ); m_base_name = path.stem().string(); m_output_dir = path.parent_path().string(); + if (m_output_dir == "") + m_output_dir = "."; } } diff --git a/opm/parser/eclipse/EclipseState/tests/EclipseStateTests.cpp b/opm/parser/eclipse/EclipseState/tests/EclipseStateTests.cpp index e1b1fc344..6aef1cb6d 100644 --- a/opm/parser/eclipse/EclipseState/tests/EclipseStateTests.cpp +++ b/opm/parser/eclipse/EclipseState/tests/EclipseStateTests.cpp @@ -414,6 +414,13 @@ BOOST_AUTO_TEST_CASE(TestIOConfigBaseName) { DeckConstPtr deck = parser->parseFile("testdata/integration_tests/IOConfig/SPE1CASE2.DATA", parseContext); EclipseState state(*deck, parseContext); BOOST_CHECK_EQUAL(state.getIOConfig()->getBaseName(), "SPE1CASE2"); + BOOST_CHECK_EQUAL(state.getIOConfig()->getOutputDir(), "testdata/integration_tests/IOConfig"); + + ParserPtr parser2(new Parser()); + DeckConstPtr deck2 = createDeckWithGridOpts(); + EclipseState state2(*deck2, parseContext); + BOOST_CHECK_EQUAL(state2.getIOConfig()->getBaseName(), ""); + BOOST_CHECK_EQUAL(state2.getIOConfig()->getOutputDir(), "."); } BOOST_AUTO_TEST_CASE(TestIOConfigCreation) { diff --git a/opm/parser/eclipse/Parser/Parser.cpp b/opm/parser/eclipse/Parser/Parser.cpp index aa97a6e23..d6b50c24a 100644 --- a/opm/parser/eclipse/Parser/Parser.cpp +++ b/opm/parser/eclipse/Parser/Parser.cpp @@ -271,7 +271,7 @@ ParserState::ParserState( const ParseContext& context, deck( new Deck() ), parseContext( context ) { - loadFile( p ); + openRootFile( p ); } void ParserState::loadString(const std::string& input) {