diff options
author | Katja Marttila <katja.marttila@theqtcompany.com> | 2016-05-05 15:18:34 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2016-06-21 04:51:29 +0000 |
commit | 76fd6e8f2953347ea0bf7a57b643968784bc9acc (patch) | |
tree | adc2ed4e61b4778c8995de6760bf514b8e3b3d37 /tools | |
parent | e28bd0a98dd1a7ca0846cd406b23c6e5429ac82d (diff) |
Allow signing maintenancetool in Windows
Signing was not possible for maintenancetool since metadata was
added to binary. Separated metadata to installer.dat like in OS X.
Task-number: QTIFW-667
Change-Id: I74ef307c51a2f43059475dd943d6f0910925fa86
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/binarycreator/binarycreator.cpp | 9 | ||||
-rw-r--r-- | tools/devtool/main.cpp | 11 |
2 files changed, 17 insertions, 3 deletions
diff --git a/tools/binarycreator/binarycreator.cpp b/tools/binarycreator/binarycreator.cpp index 1a6a10471..23261211d 100644 --- a/tools/binarycreator/binarycreator.cpp +++ b/tools/binarycreator/binarycreator.cpp @@ -241,10 +241,12 @@ static int assemble(Input input, const QInstaller::Settings &settings, const QSt QTemporaryFile out; QString targetName = input.outputPath; -#ifdef Q_OS_OSX +#if defined Q_OS_OSX || defined Q_OS_WIN QDir resourcePath(QFileInfo(input.outputPath).dir()); +#ifdef Q_OS_OSX resourcePath.cdUp(); resourcePath.cd(QLatin1String("Resources")); +#endif targetName = resourcePath.filePath(QLatin1String("installer.dat")); #endif @@ -262,7 +264,10 @@ static int assemble(Input input, const QInstaller::Settings &settings, const QSt QInstaller::openForWrite(&out); QFile exe(input.installerExePath); -#ifdef Q_OS_OSX +#if defined Q_OS_OSX || defined Q_OS_WIN + // remove the target + if (QFile::exists(input.outputPath)) + QFile::remove(input.outputPath); if (!exe.copy(input.outputPath)) { throw Error(QString::fromLatin1("Cannot copy %1 to %2: %3").arg(exe.fileName(), input.outputPath, exe.errorString())); diff --git a/tools/devtool/main.cpp b/tools/devtool/main.cpp index c9aaab71c..27c459ecc 100644 --- a/tools/devtool/main.cpp +++ b/tools/devtool/main.cpp @@ -173,6 +173,11 @@ int main(int argc, char *argv[]) if (QInstaller::isInBundle(path, &bundlePath)) path = QDir(bundlePath).filePath(QLatin1String("Contents/Resources/installer.dat")); +#ifdef Q_OS_WIN + QDir resourcePath(path); + resourcePath.cdUp(); + path = resourcePath.filePath(QLatin1String("installer.dat")); +#endif int result = EXIT_FAILURE; QVector<QByteArray> resourceMappings; quint64 cookie = QInstaller::BinaryContent::MagicCookie; @@ -191,8 +196,12 @@ int main(int argc, char *argv[]) QFileInfo fi(path); if (QInstaller::isInBundle(fi.absoluteFilePath(), &bundlePath)) fi.setFile(bundlePath); +#ifdef Q_OS_WIN + QFileInfo appName = arguments.first(); + path = fi.absoluteDir().filePath(appName.baseName() + QLatin1String(".dat")); +#else path = fi.absolutePath() + QLatin1Char('/') + fi.baseName() + QLatin1String(".dat"); - +#endif tmp.close(); tmp.setFileName(path); QInstaller::openForRead(&tmp); |