#1475 Use caf::Utils::fileExists

This commit is contained in:
Magne Sjaastad 2017-05-15 13:40:13 +02:00
parent 886f4ce3ab
commit 1a075470cf
3 changed files with 6 additions and 20 deletions

View File

@ -24,30 +24,19 @@
#include <fstream>
#include "cafUtils.h"
#include <QFileInfo>
#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)
{
CVF_ASSERT(canReadFile(filePath));
CVF_ASSERT(caf::Utils::fileExists(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)
{
CVF_ASSERT(canReadFile(filePath));
CVF_ASSERT(caf::Utils::fileExists(filePath));
if (isJsonFile(filePath))
{

View File

@ -59,8 +59,6 @@ public:
WellMetaData readWellMetaData(const QString& filePath);
size_t wellDataCount(const QString& filePath);
static bool canReadFile(const QString& filePath);
void clear();
void removeFilePath(const QString& filePath);

View File

@ -39,9 +39,8 @@
#include "RivWellPathPartMgr.h"
#include "cafUtils.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafUtils.h"
#include <QDateTime>
#include <QDir>
@ -218,7 +217,7 @@ caf::PdmFieldHandle* RimWellPath::objectToggleField()
//--------------------------------------------------------------------------------------------------
bool RimWellPath::readWellPathFile(QString* errorMessage, RifWellPathImporter* wellPathImporter)
{
if (wellPathImporter->canReadFile(filepath()))
if (caf::Utils::fileExists(filepath()))
{
RifWellPathImporter::WellData wellData = wellPathImporter->readWellData(filepath(), wellPathIndexInFile());
RifWellPathImporter::WellMetaData wellMetaData = wellPathImporter->readWellMetaData(filepath(), wellPathIndexInFile());