mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improved robustness for reading faults
This commit is contained in:
parent
dbe54ff9bf
commit
2e45fc41cb
@ -671,13 +671,13 @@ qint64 RifEclipseInputFileTools::findKeyword(const QString& keyword, QFile& file
|
||||
do
|
||||
{
|
||||
line = file.readLine();
|
||||
line = line.trimmed();
|
||||
|
||||
if (line.startsWith("--", Qt::CaseInsensitive))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
line = line.trimmed();
|
||||
|
||||
if (line.startsWith(keyword, Qt::CaseInsensitive))
|
||||
{
|
||||
return file.pos();
|
||||
@ -706,6 +706,8 @@ bool RifEclipseInputFileTools::readFaultsAndParseIncludeStatementsRecursively(QF
|
||||
do
|
||||
{
|
||||
line = file.readLine();
|
||||
line = line.trimmed();
|
||||
|
||||
if (line.startsWith("--", Qt::CaseInsensitive))
|
||||
{
|
||||
continue;
|
||||
@ -720,14 +722,19 @@ bool RifEclipseInputFileTools::readFaultsAndParseIncludeStatementsRecursively(QF
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
line = line.trimmed();
|
||||
if (line.startsWith(includeKeyword, Qt::CaseInsensitive))
|
||||
{
|
||||
QString nextLine = file.readLine();
|
||||
line = file.readLine();
|
||||
line = line.trimmed();
|
||||
|
||||
int firstQuote = nextLine.indexOf("'");
|
||||
int lastQuote = nextLine.lastIndexOf("'");
|
||||
while (line.startsWith("--", Qt::CaseInsensitive))
|
||||
{
|
||||
line = file.readLine();
|
||||
line = line.trimmed();
|
||||
}
|
||||
|
||||
int firstQuote = line.indexOf("'");
|
||||
int lastQuote = line.lastIndexOf("'");
|
||||
|
||||
if (!(firstQuote < 0 || lastQuote < 0 || firstQuote == lastQuote))
|
||||
{
|
||||
@ -738,7 +745,7 @@ bool RifEclipseInputFileTools::readFaultsAndParseIncludeStatementsRecursively(QF
|
||||
}
|
||||
|
||||
// Read include file name, and both relative and absolute path is supported
|
||||
QString includeFilename = nextLine.mid(firstQuote + 1, lastQuote - firstQuote - 1);
|
||||
QString includeFilename = line.mid(firstQuote + 1, lastQuote - firstQuote - 1);
|
||||
QFileInfo fi(currentFileFolder, includeFilename);
|
||||
if (fi.exists())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user