mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1476 Add helper method fileExists() which includes isFile()
This commit is contained in:
parent
0472230523
commit
e1e75a4fad
@ -223,4 +223,22 @@ bool Utils::getSaveDirectoryAndCheckOverwriteFiles(const QString& defaultDir, st
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool Utils::fileExists(const QString& fileName)
|
||||||
|
{
|
||||||
|
QFileInfo fi(fileName);
|
||||||
|
|
||||||
|
// QFileInfo::exists returns true for both files and folders
|
||||||
|
// Also check if the path points to a file
|
||||||
|
|
||||||
|
if (fi.exists() && fi.isFile())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace caf
|
} // namespace caf
|
||||||
|
@ -63,6 +63,8 @@ public:
|
|||||||
static QString indentString(int numSpacesToIndent, const QString& str);
|
static QString indentString(int numSpacesToIndent, const QString& str);
|
||||||
|
|
||||||
static bool getSaveDirectoryAndCheckOverwriteFiles(const QString& defaultDir, std::vector<QString> fileNames, QString* saveDir);
|
static bool getSaveDirectoryAndCheckOverwriteFiles(const QString& defaultDir, std::vector<QString> fileNames, QString* saveDir);
|
||||||
|
|
||||||
|
static bool fileExists(const QString& fileName);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user