mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5847 Eclipse Ascii Case: Import of properties with comment in header fails
This commit is contained in:
parent
4d98a8d502
commit
5de98ea7b0
@ -846,24 +846,50 @@ bool RifEclipseInputFileTools::readProperty( const QString& fileName,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ecl_kw_type* eclipseKeywordData = ecl_kw_fscanf_alloc_grdecl_dynamic__( filePointer,
|
qint64 filePos = -1;
|
||||||
eclipseKeyWord.toLatin1().data(),
|
|
||||||
false,
|
|
||||||
ecl_type_create_from_type( ECL_FLOAT_TYPE ) );
|
|
||||||
bool isOk = false;
|
|
||||||
if ( eclipseKeywordData )
|
|
||||||
{
|
{
|
||||||
QString errMsg;
|
std::vector<RifKeywordAndFilePos> keywordsAndFilePos;
|
||||||
isOk = readDataFromKeyword( eclipseKeywordData, caseData, resultName, &errMsg );
|
findKeywordsOnFile( fileName, &keywordsAndFilePos );
|
||||||
if ( !isOk )
|
for ( auto kwAndPos : keywordsAndFilePos )
|
||||||
{
|
{
|
||||||
RiaLogging::error( QString( "Failed to read property: %1" ).arg( errMsg ) );
|
if ( kwAndPos.keyword == eclipseKeyWord )
|
||||||
|
{
|
||||||
|
filePos = kwAndPos.filePos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ecl_kw_free( eclipseKeywordData );
|
}
|
||||||
|
|
||||||
|
bool isOk = false;
|
||||||
|
|
||||||
|
if ( filePos == -1 )
|
||||||
|
{
|
||||||
|
RiaLogging::error( QString( "Failed to load keyword %1 from file: %2" ).arg( eclipseKeyWord ).arg( fileName ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RiaLogging::error( QString( "Failed to load keyword %1 from file: %2" ).arg( eclipseKeyWord ).arg( fileName ) );
|
fseek( filePointer, filePos, SEEK_SET );
|
||||||
|
|
||||||
|
ecl_kw_type* eclipseKeywordData =
|
||||||
|
ecl_kw_fscanf_alloc_grdecl_dynamic__( filePointer,
|
||||||
|
eclipseKeyWord.toLatin1().data(),
|
||||||
|
false,
|
||||||
|
ecl_type_create_from_type( ECL_FLOAT_TYPE ) );
|
||||||
|
|
||||||
|
if ( eclipseKeywordData )
|
||||||
|
{
|
||||||
|
QString errMsg;
|
||||||
|
isOk = readDataFromKeyword( eclipseKeywordData, caseData, resultName, &errMsg );
|
||||||
|
if ( !isOk )
|
||||||
|
{
|
||||||
|
RiaLogging::error( QString( "Failed to read property: %1" ).arg( errMsg ) );
|
||||||
|
}
|
||||||
|
ecl_kw_free( eclipseKeywordData );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RiaLogging::error( QString( "Failed to load keyword %1 from file: %2" ).arg( eclipseKeyWord ).arg( fileName ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose( filePointer );
|
fclose( filePointer );
|
||||||
|
Loading…
Reference in New Issue
Block a user