fixed bug in Parser, use openRootFile

This commit is contained in:
Pål Grønås Drange
2016-05-03 14:07:21 +02:00
parent d9eb3ebf86
commit 672b240e00
3 changed files with 10 additions and 1 deletions

View File

@@ -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 = ".";
}
}

View File

@@ -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) {

View File

@@ -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) {