Fixed "Build failed".

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-12-19 22:15:42 +02:00
parent 40bf125fdf
commit 95772bf0db

View File

@ -761,25 +761,42 @@ bool VDomDocument::SafeCopy(const QString &source, const QString &destination, Q
qt_ntfs_permission_lookup++; // turn checking on qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/ #endif /*Q_OS_WIN32*/
QTemporaryFile patternFile(destination + QLatin1Literal(".XXXXXX")); QTemporaryFile destFile(destination + QLatin1Literal(".XXXXXX"));
if (not patternFile.setPermissions(QFile::ReadOwner | QFile::WriteOwner)) destFile.setAutoRemove(false);
if (not destFile.open())
{ {
error = patternFile.errorString(); error = destFile.errorString();
result = false; result = false;
} }
else else
{ {
QFile sourceFile(source); QFile sourceFile(source);
if ( not sourceFile.copy(patternFile.fileName()) ) if (sourceFile.open(QIODevice::ReadOnly))
{
result = true;
char block[4096];
qint64 bytes;
while ((bytes = sourceFile.read(block, sizeof(block))) > 0)
{
if (bytes != destFile.write(block, bytes))
{
error = destFile.errorString();
result = false;
break;
}
}
if (bytes == -1)
{ {
error = sourceFile.errorString(); error = sourceFile.errorString();
result = false; result = false;
} }
else
if (result)
{ {
if (not patternFile.rename(destination)) if (not destFile.rename(destination))
{ {
error = patternFile.errorString(); error = destFile.errorString();
result = false; result = false;
} }
else else
@ -788,6 +805,7 @@ bool VDomDocument::SafeCopy(const QString &source, const QString &destination, Q
} }
} }
} }
}
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--; // turn off check permission again qt_ntfs_permission_lookup--; // turn off check permission again