moveToTrash/Unix: rename 'infoPath' variable to 'pathForInfo'
We have other variables whose name start with 'info' in this function, so infoPath is misleading: it's not the path to infoFile and it isn't related to the infoFileName. Instead, it's the path to the file being trashed which will be saved in the info file. Change-Id: I9d43e5b91eb142d6945cfffd1786d358a0e02dfd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 6434b6ea486bbb959a15d83322b6869d8f29b9bc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
f3e34e9466
commit
290a9ec13c
@ -1364,14 +1364,14 @@ bool QFileSystemEngine::moveFileToTrash(const QFileSystemEntry &source,
|
|||||||
const QString targetPath = trashDir.filePath(filesDir) + uniqueTrashedName;
|
const QString targetPath = trashDir.filePath(filesDir) + uniqueTrashedName;
|
||||||
const QFileSystemEntry target(targetPath);
|
const QFileSystemEntry target(targetPath);
|
||||||
|
|
||||||
QString infoPath;
|
QString pathForInfo;
|
||||||
const QStorageInfo storageInfo(sourcePath);
|
const QStorageInfo storageInfo(sourcePath);
|
||||||
if (storageInfo.isValid() && storageInfo.rootPath() != rootPath() && storageInfo != QStorageInfo(QDir::home())) {
|
if (storageInfo.isValid() && storageInfo.rootPath() != rootPath() && storageInfo != QStorageInfo(QDir::home())) {
|
||||||
infoPath = sourcePath.mid(storageInfo.rootPath().length());
|
pathForInfo = sourcePath.mid(storageInfo.rootPath().length());
|
||||||
if (infoPath.front() == u'/')
|
if (pathForInfo.front() == u'/')
|
||||||
infoPath = infoPath.mid(1);
|
pathForInfo = pathForInfo.mid(1);
|
||||||
} else {
|
} else {
|
||||||
infoPath = sourcePath;
|
pathForInfo = sourcePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1387,7 +1387,7 @@ bool QFileSystemEngine::moveFileToTrash(const QFileSystemEntry &source,
|
|||||||
|
|
||||||
QByteArray info =
|
QByteArray info =
|
||||||
"[Trash Info]\n"
|
"[Trash Info]\n"
|
||||||
"Path=" + QUrl::toPercentEncoding(infoPath, "/") + "\n"
|
"Path=" + QUrl::toPercentEncoding(pathForInfo, "/") + "\n"
|
||||||
"DeletionDate=" + QDateTime::currentDateTime().toString(Qt::ISODate).toUtf8()
|
"DeletionDate=" + QDateTime::currentDateTime().toString(Qt::ISODate).toUtf8()
|
||||||
+ "\n";
|
+ "\n";
|
||||||
infoFile.write(info);
|
infoFile.write(info);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user