mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1475 Use caf::Utils::fileExists
This commit is contained in:
parent
886f4ce3ab
commit
1a075470cf
@ -24,30 +24,19 @@
|
|||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
#include "cafUtils.h"
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
#define ASCII_FILE_DEFAULT_START_INDEX 0
|
#define ASCII_FILE_DEFAULT_START_INDEX 0
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool RifWellPathImporter::canReadFile(const QString& filePath)
|
|
||||||
{
|
|
||||||
QFileInfo fileInfo(filePath);
|
|
||||||
if (fileInfo.isFile() && fileInfo.exists())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RifWellPathImporter::WellData RifWellPathImporter::readWellData(const QString& filePath, size_t indexInFile)
|
RifWellPathImporter::WellData RifWellPathImporter::readWellData(const QString& filePath, size_t indexInFile)
|
||||||
{
|
{
|
||||||
CVF_ASSERT(canReadFile(filePath));
|
CVF_ASSERT(caf::Utils::fileExists(filePath));
|
||||||
|
|
||||||
if (isJsonFile(filePath))
|
if (isJsonFile(filePath))
|
||||||
{
|
{
|
||||||
@ -72,7 +61,7 @@ RifWellPathImporter::WellData RifWellPathImporter::readWellData(const QString& f
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RifWellPathImporter::WellMetaData RifWellPathImporter::readWellMetaData(const QString& filePath, size_t indexInFile)
|
RifWellPathImporter::WellMetaData RifWellPathImporter::readWellMetaData(const QString& filePath, size_t indexInFile)
|
||||||
{
|
{
|
||||||
CVF_ASSERT(canReadFile(filePath));
|
CVF_ASSERT(caf::Utils::fileExists(filePath));
|
||||||
|
|
||||||
if (isJsonFile(filePath))
|
if (isJsonFile(filePath))
|
||||||
{
|
{
|
||||||
|
@ -59,8 +59,6 @@ public:
|
|||||||
WellMetaData readWellMetaData(const QString& filePath);
|
WellMetaData readWellMetaData(const QString& filePath);
|
||||||
size_t wellDataCount(const QString& filePath);
|
size_t wellDataCount(const QString& filePath);
|
||||||
|
|
||||||
static bool canReadFile(const QString& filePath);
|
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
void removeFilePath(const QString& filePath);
|
void removeFilePath(const QString& filePath);
|
||||||
|
|
||||||
|
@ -39,9 +39,8 @@
|
|||||||
|
|
||||||
#include "RivWellPathPartMgr.h"
|
#include "RivWellPathPartMgr.h"
|
||||||
|
|
||||||
#include "cafUtils.h"
|
|
||||||
|
|
||||||
#include "cafPdmUiTreeOrdering.h"
|
#include "cafPdmUiTreeOrdering.h"
|
||||||
|
#include "cafUtils.h"
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@ -218,7 +217,7 @@ caf::PdmFieldHandle* RimWellPath::objectToggleField()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimWellPath::readWellPathFile(QString* errorMessage, RifWellPathImporter* wellPathImporter)
|
bool RimWellPath::readWellPathFile(QString* errorMessage, RifWellPathImporter* wellPathImporter)
|
||||||
{
|
{
|
||||||
if (wellPathImporter->canReadFile(filepath()))
|
if (caf::Utils::fileExists(filepath()))
|
||||||
{
|
{
|
||||||
RifWellPathImporter::WellData wellData = wellPathImporter->readWellData(filepath(), wellPathIndexInFile());
|
RifWellPathImporter::WellData wellData = wellPathImporter->readWellData(filepath(), wellPathIndexInFile());
|
||||||
RifWellPathImporter::WellMetaData wellMetaData = wellPathImporter->readWellMetaData(filepath(), wellPathIndexInFile());
|
RifWellPathImporter::WellMetaData wellMetaData = wellPathImporter->readWellMetaData(filepath(), wellPathIndexInFile());
|
||||||
|
Loading…
Reference in New Issue
Block a user