[PATCH] (issue158) Try to find osslsigncode also in the application's directory

Wald Commits scm-commit at wald.intevation.org
Mon Oct 13 17:56:54 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1413215810 -7200
# Node ID 137a0686de7b2551539e1b8e80a32191ea4b1a8b
# Parent  45082ec23e764a7d53383af0ab8c36a267e1e443
(issue158) Try to find osslsigncode also in the application's directory

diff -r 45082ec23e76 -r 137a0686de7b ui/createinstallerdialog.cpp
--- a/ui/createinstallerdialog.cpp	Mon Oct 13 17:41:55 2014 +0200
+++ b/ui/createinstallerdialog.cpp	Mon Oct 13 17:56:50 2014 +0200
@@ -342,7 +342,9 @@
 bool CreateInstallerDialog::signFile(QString filePath) {
     QProcess signProc;
     signProc.setProcessChannelMode(QProcess::MergedChannels);
-    signProc.setProgram("osslsigncode");
+    QStringList candidates;
+    candidates << "osslsigncode"
+        << QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/osslsigncode");
     QStringList arguments;
 
     QSettings mySettings;
@@ -356,18 +358,29 @@
               url << "-h" << hash << "-in" << filePath << "-out" << filePath + ".signed";
 
     qDebug() << "Starting osslsigncode with arguments: " << arguments;
+
     signProc.setArguments(arguments);
-    signProc.start();
+    bool once_successful = false;
+    foreach (const QString &prog, candidates) {
+        signProc.setProgram(prog);
+        signProc.start();
 
-    if (!signProc.waitForFinished(30000)) {
-        qDebug() << "Signing takes longer then 30 seconds. Aborting.";
-        return false;
+        if (!signProc.waitForFinished(30000)) {
+            continue;
+        }
+
+        if (signProc.exitStatus() != QProcess::NormalExit ||
+            signProc.exitCode() != 0) {
+            qDebug() << "Error process returned: " << signProc.exitCode();
+            qDebug() << "Output: " << signProc.readAllStandardOutput();
+            continue;
+        }
+        once_successful = true;
+        break;
     }
 
-    if (signProc.exitStatus() != QProcess::NormalExit ||
-        signProc.exitCode() != 0) {
-        qDebug() << "Error process returned: " << signProc.exitCode();
-        qDebug() << "Output: " << signProc.readAllStandardOutput();
+    if (!once_successful) {
+        qDebug() << "Failed to execute all osslsigncode candidates.";
         return false;
     }
 


More information about the Trustbridge-commits mailing list