summaryrefslogtreecommitdiffstats
path: root/tools/common
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2014-06-23 13:15:15 +0200
committerKarsten Heimrich <karsten.heimrich@digia.com>2014-06-24 10:31:08 +0200
commit924ebcdbc9b9e590a5f0905941e2d05ac34d4be2 (patch)
treee57fb26ece9f67e1c59f0967198350d0a511637a /tools/common
parent4d8d708f98172e0e49fb2f0aad2e22d7798318e5 (diff)
Split out the file IO stuff and adjust other files respectively.
Also adjust the API to use QFileDevice instead of QIODevice to make clear we just operate on files here and not on any possible device like sockets, processes etc... Change-Id: I4ecbb6e244fe4bb666ed12e62f9f5586bc1347f0 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'tools/common')
-rw-r--r--tools/common/repositorygen.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp
index b99b538f9..e8db8c1d4 100644
--- a/tools/common/repositorygen.cpp
+++ b/tools/common/repositorygen.cpp
@@ -40,6 +40,7 @@
**************************************************************************/
#include "repositorygen.h"
+#include <fileio.h>
#include <fileutils.h>
#include <errors.h>
#include <globals.h>
@@ -102,7 +103,7 @@ void QInstallerTools::copyWithException(const QString &source, const QString &ta
void QInstallerTools::compressPaths(const QStringList &paths, const QString &archivePath)
{
QFile archive(archivePath);
- QInstaller::openForWrite(&archive, archivePath);
+ QInstaller::openForWrite(&archive);
Lib7z::createArchive(&archive, paths);
}
@@ -178,7 +179,7 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met
packageXmlPath);
QFile file(packageXmlPath);
- QInstaller::openForRead(&file, packageXmlPath);
+ QInstaller::openForRead(&file);
QString errMsg;
int line = 0;
@@ -262,7 +263,7 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met
// if it's an archive already, list its files and sum the uncompressed sizes
QFile archive(fi.filePath());
compressedComponentSize += archive.size();
- QInstaller::openForRead(&archive, archive.fileName());
+ QInstaller::openForRead(&archive);
QVector<Lib7z::File>::const_iterator fileIt;
const QVector<Lib7z::File> files = Lib7z::listArchive(&archive);
@@ -385,7 +386,7 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met
doc.appendChild(root);
QFile targetUpdatesXml(targetDir + QLatin1String("/Updates.xml"));
- QInstaller::openForWrite(&targetUpdatesXml, targetUpdatesXml.fileName());
+ QInstaller::openForWrite(&targetUpdatesXml);
QInstaller::blockingWrite(&targetUpdatesXml, doc.toByteArray());
}
@@ -561,7 +562,7 @@ void QInstallerTools::compressMetaDirectories(const QString &repoDir, const QStr
}
}
- QInstaller::openForWrite(&existingUpdatesXml, existingUpdatesXml.fileName());
+ QInstaller::openForWrite(&existingUpdatesXml);
QInstaller::blockingWrite(&existingUpdatesXml, doc.toByteArray());
existingUpdatesXml.close();
}
@@ -630,12 +631,12 @@ void QInstallerTools::copyComponentData(const QStringList &packageDirs, const QS
qDebug() << "Creating hash of archive" << archiveFile.fileName();
try {
- QInstaller::openForRead(&archiveFile, archiveFile.fileName());
+ QInstaller::openForRead(&archiveFile);
const QByteArray hashOfArchiveData = QInstaller::calculateHash(&archiveFile,
QCryptographicHash::Sha1).toHex();
archiveFile.close();
- QInstaller::openForWrite(&archiveHashFile, archiveHashFile.fileName());
+ QInstaller::openForWrite(&archiveHashFile);
archiveHashFile.write(hashOfArchiveData);
qDebug() << "Generated sha1 hash:" << hashOfArchiveData;
(*infos)[i].copiedFiles.append(archiveHashFile.fileName());