mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3009 Warn user when loading an eclipse EGRID with mixed UPPER and lower case file name.
This commit is contained in:
parent
2eee3f770b
commit
62792b59c4
@ -263,6 +263,14 @@ QStringList RifEclipseOutputFileTools::filterFileNamesOfType(const QStringList&
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
/// Check if libecl accepts the file name. libecl refuses to open files with mixed case in the file name.
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
bool RifEclipseOutputFileTools::isValidEclipseFileName(const QString& fileName)
|
||||
{
|
||||
QString fileNameBase = QFileInfo(fileName).completeBaseName();
|
||||
return ecl_util_valid_basename(RiaStringEncodingTools::toNativeEncoded(fileNameBase).data());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Get set of Eclipse files based on an input file and its path
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
|
||||
static void timeSteps(ecl_file_type* ecl_file, std::vector<QDateTime>* timeSteps, std::vector<double>* daysSinceSimulationStart);
|
||||
|
||||
static bool isValidEclipseFileName(const QString& fileName);
|
||||
static bool findSiblingFilesWithSameBaseName(const QString& fileName, QStringList* fileSet);
|
||||
|
||||
static QString firstFileNameOfType(const QStringList& fileSet, ecl_file_enum fileType);
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "ert/ecl/ecl_nnc_data.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
#include <iostream>
|
||||
@ -361,6 +362,14 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* e
|
||||
|
||||
progInfo.setProgressDescription("Reading Grid");
|
||||
|
||||
if (!RifEclipseOutputFileTools::isValidEclipseFileName(fileName))
|
||||
{
|
||||
QString errorMessage = QFileInfo(fileName).fileName() + QString(" is not a valid Eclipse file name.\n"
|
||||
"Please make sure the file does not contain a mix of upper and lower case letters.");
|
||||
RiaLogging::error(errorMessage);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get set of files
|
||||
QStringList fileSet;
|
||||
if (!RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(fileName, &fileSet)) return false;
|
||||
|
Loading…
Reference in New Issue
Block a user