Try be more verbose when copy test files.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-07-25 20:01:19 +03:00
parent c793f869e5
commit b5457867e5

View File

@ -138,9 +138,11 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg
{
QDir targetDir(tgtFilePath);
targetDir.cdUp();
if (not targetDir.mkdir(QFileInfo(tgtFilePath).fileName()))
const QString dirName = QFileInfo(tgtFilePath).fileName();
if (not targetDir.mkdir(dirName))
{
QWARN("Can't create subdir./n");
const QString msg = QString("Can't create dir '%1'.").arg(dirName);
QWARN(qUtf8Printable(msg));
return false;
}
QDir sourceDir(srcFilePath);
@ -158,9 +160,26 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg
}
else
{
if (QFileInfo(tgtFilePath).exists())
{
const QString msg = QString("File '%1' exists.").arg(srcFilePath);
QWARN(qUtf8Printable(msg));
if (QFile::remove(tgtFilePath))
{
QWARN("File successfully removed.");
}
else
{
QWARN("Can't remove file.");
return false;
}
}
if (not QFile::copy(srcFilePath, tgtFilePath))
{
QWARN("Can't copy file./n");
const QString msg = QString("Can't copy file '%1' to '%2'.").arg(srcFilePath).arg(tgtFilePath);
QWARN(qUtf8Printable(msg));
return false;
}
}