rcc: Make output deterministic for directories
QDirIterator is documented to be non-deterministic. Fixes: QTBUG-86675 Pick-to: 5.15 Change-Id: I4161871a409bbaf85347ee6a60ef1189f56a1b22 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
parent
0da5726a43
commit
5d8f6beb46
@ -641,26 +641,31 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
|
|||||||
QDir dir(file.filePath());
|
QDir dir(file.filePath());
|
||||||
if (!alias.endsWith(slash))
|
if (!alias.endsWith(slash))
|
||||||
alias += slash;
|
alias += slash;
|
||||||
|
|
||||||
|
QStringList filePaths;
|
||||||
QDirIterator it(dir, QDirIterator::FollowSymlinks|QDirIterator::Subdirectories);
|
QDirIterator it(dir, QDirIterator::FollowSymlinks|QDirIterator::Subdirectories);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
it.next();
|
it.next();
|
||||||
QFileInfo child(it.fileInfo());
|
if (it.fileName() == QLatin1String(".")
|
||||||
if (child.fileName() != QLatin1String(".") && child.fileName() != QLatin1String("..")) {
|
|| it.fileName() == QLatin1String(".."))
|
||||||
const bool arc =
|
continue;
|
||||||
|
filePaths.append(it.filePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
// make rcc output deterministic
|
||||||
|
std::sort(filePaths.begin(), filePaths.end());
|
||||||
|
|
||||||
|
for (const QString &filePath : filePaths) {
|
||||||
|
QFileInfo child(filePath);
|
||||||
|
const bool arc =
|
||||||
addFile(alias + child.fileName(),
|
addFile(alias + child.fileName(),
|
||||||
RCCFileInfo(child.fileName(),
|
RCCFileInfo(child.fileName(), child, language, country,
|
||||||
child,
|
child.isDir() ? RCCFileInfo::Directory
|
||||||
language,
|
: RCCFileInfo::NoFlags,
|
||||||
country,
|
compressAlgo, compressLevel, compressThreshold,
|
||||||
child.isDir() ? RCCFileInfo::Directory : RCCFileInfo::NoFlags,
|
m_noZstd));
|
||||||
compressAlgo,
|
if (!arc)
|
||||||
compressLevel,
|
m_failedResources.push_back(child.fileName());
|
||||||
compressThreshold,
|
|
||||||
m_noZstd)
|
|
||||||
);
|
|
||||||
if (!arc)
|
|
||||||
m_failedResources.push_back(child.fileName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (listMode || file.isFile()) {
|
} else if (listMode || file.isFile()) {
|
||||||
const bool arc =
|
const bool arc =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user