#1476 Include isFile() when checking if a file exists

This commit is contained in:
Magne Sjaastad
2017-05-11 09:23:13 +02:00
parent e1e75a4fad
commit 84b922ba82
12 changed files with 45 additions and 31 deletions

View File

@@ -30,6 +30,7 @@
#include "RimWellPathCollection.h"
#include "cafPdmUiItem.h"
#include "cafUtils.h"
#include <QFileInfo>
#include <QDir>
@@ -81,7 +82,7 @@ QString RimTools::relocateFile(const QString& orgFileName, const QString& orgNew
bool isWindowsPath = false;
if (orgFileName.count("/")) isWindowsPath = false; // "/" are not allowed in a windows path
else if (orgFileName.count("\\")
&& !QFile::exists(orgFileName)) // To make sure we do not convert single linux files containing "\"
&& !caf::Utils::fileExists(orgFileName)) // To make sure we do not convert single linux files containing "\"
{
isWindowsPath = true;
}
@@ -93,7 +94,7 @@ QString RimTools::relocateFile(const QString& orgFileName, const QString& orgNew
}
if (searchedPaths) searchedPaths->push_back(fileName);
if (QFile::exists(fileName))
if (caf::Utils::fileExists(fileName))
{
return fileName;
}
@@ -104,7 +105,7 @@ QString RimTools::relocateFile(const QString& orgFileName, const QString& orgNew
QString candidate = QDir::fromNativeSeparators(newProjectPath + QDir::separator() + fileNameWithoutPath);
if (searchedPaths) searchedPaths->push_back(candidate);
if (QFile::exists(candidate))
if (caf::Utils::fileExists(candidate))
{
return candidate;
}
@@ -199,7 +200,7 @@ QString RimTools::relocateFile(const QString& orgFileName, const QString& orgNew
if (searchedPaths) searchedPaths->push_back(relocatedFileName);
if (QFile::exists(relocatedFileName))
if (caf::Utils::fileExists(relocatedFileName))
{
return relocatedFileName;
}