Fixed "Build failed".
--HG-- branch : develop
This commit is contained in:
parent
40bf125fdf
commit
95772bf0db
|
@ -761,25 +761,42 @@ bool VDomDocument::SafeCopy(const QString &source, const QString &destination, Q
|
|||
qt_ntfs_permission_lookup++; // turn checking on
|
||||
#endif /*Q_OS_WIN32*/
|
||||
|
||||
QTemporaryFile patternFile(destination + QLatin1Literal(".XXXXXX"));
|
||||
if (not patternFile.setPermissions(QFile::ReadOwner | QFile::WriteOwner))
|
||||
QTemporaryFile destFile(destination + QLatin1Literal(".XXXXXX"));
|
||||
destFile.setAutoRemove(false);
|
||||
if (not destFile.open())
|
||||
{
|
||||
error = patternFile.errorString();
|
||||
error = destFile.errorString();
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
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();
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
|
||||
if (result)
|
||||
{
|
||||
if (not patternFile.rename(destination))
|
||||
if (not destFile.rename(destination))
|
||||
{
|
||||
error = patternFile.errorString();
|
||||
error = destFile.errorString();
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
|
@ -788,6 +805,7 @@ bool VDomDocument::SafeCopy(const QString &source, const QString &destination, Q
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
qt_ntfs_permission_lookup--; // turn off check permission again
|
||||
|
|
Loading…
Reference in New Issue
Block a user