Don't use a QTextStream to write the trash info file
Using a QTextStream to write the file is probably around 50 times slower than simply creating the required string here and writing it. Change-Id: Ia848e4ad2688f098c671938d7ad9aaa4764a4158 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This commit is contained in:
parent
42d2d70abe
commit
a308df82ae
@ -43,7 +43,6 @@
|
|||||||
#include "qfilesystemengine_p.h"
|
#include "qfilesystemengine_p.h"
|
||||||
#include "qfile.h"
|
#include "qfile.h"
|
||||||
#include "qstorageinfo.h"
|
#include "qstorageinfo.h"
|
||||||
#include "qtextstream.h"
|
|
||||||
|
|
||||||
#include <QtCore/qoperatingsystemversion.h>
|
#include <QtCore/qoperatingsystemversion.h>
|
||||||
#include <QtCore/private/qcore_unix_p.h>
|
#include <QtCore/private/qcore_unix_p.h>
|
||||||
@ -1393,14 +1392,12 @@ bool QFileSystemEngine::moveFileToTrash(const QFileSystemEntry &source,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextStream out(&infoFile);
|
QByteArray info =
|
||||||
#if QT_CONFIG(textcodec)
|
"[Trash Info]\n"
|
||||||
out.setCodec("UTF-8");
|
"Path=" + sourcePath.toUtf8() + "\n"
|
||||||
#endif
|
"DeletionDate=" + QDateTime::currentDateTime().toString(QLatin1String("yyyy-MM-ddThh:mm:ss")).toUtf8()
|
||||||
out << "[Trash Info]" << Qt::endl;
|
+ "\n";
|
||||||
out << "Path=" << sourcePath << Qt::endl;
|
infoFile.write(info);
|
||||||
out << "DeletionDate="
|
|
||||||
<< QDateTime::currentDateTime().toString(QLatin1String("yyyy-MM-ddThh:mm:ss")) << Qt::endl;
|
|
||||||
infoFile.close();
|
infoFile.close();
|
||||||
|
|
||||||
newLocation = QFileSystemEntry(targetPath);
|
newLocation = QFileSystemEntry(targetPath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user