summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemengine_unix.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2023-09-20 22:56:46 -0700
committerThiago Macieira <thiago.macieira@intel.com>2023-09-23 08:18:31 -0700
commit3d027f8d959879d0c0525fedd03907a607ea32ee (patch)
tree219c4b0487e1ba779602e0164906300cf789c4fc /src/corelib/io/qfilesystemengine_unix.cpp
parent6434b6ea486bbb959a15d83322b6869d8f29b9bc (diff)
moveToTrash/Unix: remove unnecessary targetPath variable
It was used twice, in both cases to create a QFileSystemEntry, so the two results were equal. Therefore, just use the first result to create the second. Pick-to: 6.6 Change-Id: I9d43e5b91eb142d6945cfffd1786d45d20485f40 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/io/qfilesystemengine_unix.cpp')
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index 2d4eb0256f..4fa28a2952 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -1362,9 +1362,6 @@ bool QFileSystemEngine::moveFileToTrash(const QFileSystemEntry &source,
uniqueTrashedName = makeUniqueTrashedName();
} while (!infoFile.isOpen());
- const QString targetPath = trashDir.filePath(filesDir) + uniqueTrashedName;
- const QFileSystemEntry target(targetPath);
-
QString pathForInfo;
const QStorageInfo storageInfo(sourcePath);
if (storageInfo.isValid() && storageInfo.rootPath() != rootPath() && storageInfo != QStorageInfo(QDir::home())) {
@@ -1380,6 +1377,7 @@ bool QFileSystemEngine::moveFileToTrash(const QFileSystemEntry &source,
In that case, we don't try further, i.e. copying and removing the original
is usually not what the user would expect to happen.
*/
+ QFileSystemEntry target(trashDir.filePath(filesDir) + uniqueTrashedName);
if (!renameFile(source, target, error)) {
infoFile.close();
infoFile.remove();
@@ -1394,7 +1392,7 @@ bool QFileSystemEngine::moveFileToTrash(const QFileSystemEntry &source,
infoFile.write(info);
infoFile.close();
- newLocation = QFileSystemEntry(targetPath);
+ newLocation = std::move(target);
return true;
#endif // QT_BOOTSTRAPPED
}