forked from qt-creator/qt-creator
Introduce and use FileName::exists()
This can use the faster route through QFileInfo::exist now. Change-Id: Idb41b5d5185d7f02eacba498fb01f483d95e8d57 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com> Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -144,7 +144,7 @@ bool FileUtils::copyRecursively(const FileName &srcFilePath, const FileName &tgt
|
||||
{
|
||||
QFileInfo srcFileInfo = srcFilePath.toFileInfo();
|
||||
if (srcFileInfo.isDir()) {
|
||||
if (!tgtFilePath.toFileInfo().exists()) {
|
||||
if (!tgtFilePath.exists()) {
|
||||
QDir targetDir(tgtFilePath.toString());
|
||||
targetDir.cdUp();
|
||||
if (!targetDir.mkdir(tgtFilePath.toFileInfo().fileName())) {
|
||||
@@ -551,6 +551,13 @@ QString FileName::toUserOutput() const
|
||||
return QDir::toNativeSeparators(toString());
|
||||
}
|
||||
|
||||
/// \returns a bool indicating whether a file with this
|
||||
/// FileName exists.
|
||||
bool FileName::exists() const
|
||||
{
|
||||
return QFileInfo::exists(*this);
|
||||
}
|
||||
|
||||
/// Find the parent directory of a given directory.
|
||||
|
||||
/// Returns an empty FileName if the current directory is already
|
||||
|
||||
Reference in New Issue
Block a user