summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2020-09-16 08:56:13 +0200
committerKai Koehne <kai.koehne@qt.io>2020-09-19 13:48:03 +0200
commit5d8f6beb4640d64a262fa918b47e0073ea39fbda (patch)
treec888f6b2fc98fe25e97695eb61e5924ef4ce13bb /src
parent0da5726a43b21d1532720c8cd3c687cc2373cd2b (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/tools/rcc/rcc.cpp37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 924f2904f0..4c463cf2a0 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -641,26 +641,31 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
QDir dir(file.filePath());
if (!alias.endsWith(slash))
alias += slash;
+
+ QStringList filePaths;
QDirIterator it(dir, QDirIterator::FollowSymlinks|QDirIterator::Subdirectories);
while (it.hasNext()) {
it.next();
- QFileInfo child(it.fileInfo());
- if (child.fileName() != QLatin1String(".") && child.fileName() != QLatin1String("..")) {
- const bool arc =
+ if (it.fileName() == QLatin1String(".")
+ || it.fileName() == QLatin1String(".."))
+ 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(),
- RCCFileInfo(child.fileName(),
- child,
- language,
- country,
- child.isDir() ? RCCFileInfo::Directory : RCCFileInfo::NoFlags,
- compressAlgo,
- compressLevel,
- compressThreshold,
- m_noZstd)
- );
- if (!arc)
- m_failedResources.push_back(child.fileName());
- }
+ RCCFileInfo(child.fileName(), child, language, country,
+ child.isDir() ? RCCFileInfo::Directory
+ : RCCFileInfo::NoFlags,
+ compressAlgo, compressLevel, compressThreshold,
+ m_noZstd));
+ if (!arc)
+ m_failedResources.push_back(child.fileName());
}
} else if (listMode || file.isFile()) {
const bool arc =