diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index 8b751e894a..b2a3b80c83 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -1478,18 +1478,27 @@ bool RiaApplication::parseArguments() QStringList caseNames = cvfqt::Utils::toQStringList(o.values()); foreach (QString caseName, caseNames) { - QString caseFileNameWithExt = caseName + ".EGRID"; - if (caf::Utils::fileExists(caseFileNameWithExt)) + QString fileExtension = caf::Utils::fileExtension(caseName); + if (caf::Utils::fileExists(caseName) && + (fileExtension == "EGRID" || fileExtension == "GRID")) { - openEclipseCaseFromFile(caseFileNameWithExt); + openEclipseCaseFromFile(caseName); } else { - caseFileNameWithExt = caseName + ".GRID"; + QString caseFileNameWithExt = caseName + ".EGRID"; if (caf::Utils::fileExists(caseFileNameWithExt)) { openEclipseCaseFromFile(caseFileNameWithExt); } + else + { + caseFileNameWithExt = caseName + ".GRID"; + if (caf::Utils::fileExists(caseFileNameWithExt)) + { + openEclipseCaseFromFile(caseFileNameWithExt); + } + } } } } diff --git a/Fwk/AppFwk/CommonCode/cafUtils.cpp b/Fwk/AppFwk/CommonCode/cafUtils.cpp index 679170b94b..31cb2f6cf0 100644 --- a/Fwk/AppFwk/CommonCode/cafUtils.cpp +++ b/Fwk/AppFwk/CommonCode/cafUtils.cpp @@ -241,4 +241,14 @@ bool Utils::fileExists(const QString& fileName) return false; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString Utils::fileExtension(const QString & fileName) +{ + QFileInfo fi(fileName); + + return fi.suffix(); +} + } // namespace caf diff --git a/Fwk/AppFwk/CommonCode/cafUtils.h b/Fwk/AppFwk/CommonCode/cafUtils.h index cb92cee651..dde22b2837 100644 --- a/Fwk/AppFwk/CommonCode/cafUtils.h +++ b/Fwk/AppFwk/CommonCode/cafUtils.h @@ -65,6 +65,7 @@ public: static bool getSaveDirectoryAndCheckOverwriteFiles(const QString& defaultDir, std::vector fileNames, QString* saveDir); static bool fileExists(const QString& fileName); + static QString fileExtension(const QString& fileName); }; }