summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorChristoph VogtlÃĪnder <c.vogtlaender@sigma-surface-science.com>2014-11-12 17:57:35 +0100
committerKarsten Heimrich <karsten.heimrich@theqtcompany.com>2014-11-13 11:44:36 +0100
commitfe97303ee7bf61db6e24880acb805a88c633d9ba (patch)
treef296b9aeedc5d62090a59d3fb5581c1a0e7e3f0b /tools
parentb67c842ba8bba3ba908fffe9546ad364693acb2c (diff)
Fix binary data extraction
Extract binary data based on list of available package names when using "devtool --dump" or "--create-offline-repository" installer option. An entry in meta data resource only exists if the component actually has meta data (e.g. a script) so it is not possible to rely on sub directory structure after copying meta data to extract binary data. Change-Id: Icd70d3495a921229f0043360b93905dc36cf6514 Task-number: QTIFW-574 Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/devtool/binarydump.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/devtool/binarydump.cpp b/tools/devtool/binarydump.cpp
index 0952c92a4..046d41d25 100644
--- a/tools/devtool/binarydump.cpp
+++ b/tools/devtool/binarydump.cpp
@@ -108,22 +108,22 @@ int BinaryDump::dump(const QInstaller::ResourceCollectionManager &manager, const
}
}
- QDirIterator it(targetDir, QDirIterator::Subdirectories);
- while (it.hasNext() && !it.next().isEmpty()) {
- if (!it.fileInfo().isDir())
- continue;
-
- const QString fileName = it.fileName();
- const QInstaller::ResourceCollection c = manager.collectionByName(fileName.toUtf8());
+ foreach (const QString &name, versionMap.keys()) {
+ const QInstaller::ResourceCollection c = manager.collectionByName(name.toUtf8());
if (c.resources().count() <= 0)
continue;
+ if (!targetDir.mkpath(name)) {
+ throw QInstaller::Error(QString::fromLatin1("Could not create target dir: %1.")
+ .arg(targetDir.filePath(name)));
+ }
+
foreach (const QSharedPointer<QInstaller::Resource> &resource, c.resources()) {
const bool isOpen = resource->isOpen();
if ((!isOpen) && (!resource->open()))
continue; // TODO: should we throw here?
- QFile target(targetDir.filePath(fileName) + QDir::separator()
+ QFile target(targetDir.filePath(name) + QDir::separator()
+ QString::fromUtf8(resource->name()));
QInstaller::openForWrite(&target);
resource->copyData(&target); // copy the 7z files into the target directory