diff base/HelperExecPath.cpp @ 1246:75aefcc9f07d piper

Use plugin scan results to inform the list requests issued to Piper servers
author Chris Cannam
date Thu, 03 Nov 2016 14:14:09 +0000
parents c7a710f806a1
children a9d0b5a2c242
line wrap: on
line diff
--- a/base/HelperExecPath.cpp	Tue Nov 01 16:02:15 2016 +0000
+++ b/base/HelperExecPath.cpp	Thu Nov 03 14:14:09 2016 +0000
@@ -20,13 +20,17 @@
 #include <QDir>
 #include <QFileInfo>
 
-static QStringList
-getSuffixes()
+QStringList
+HelperExecPath::getTags()
 {
     if (sizeof(void *) == 8) {
-        return { "-64", "", "-32" };
+        if (m_type == NativeArchitectureOnly) {
+            return { "64", "" };
+        } else {
+            return { "64", "", "32" };
+        }
     } else {
-        return { "", "-32" };
+        return { "", "32" };
     }
 }
 
@@ -36,7 +40,7 @@
     return QFile(path).exists() && QFileInfo(path).isExecutable();
 }
 
-QStringList
+QList<HelperExecPath::HelperExec>
 HelperExecPath::getHelperExecutables(QString basename)
 {
     QStringList dummy;
@@ -46,9 +50,9 @@
 QString
 HelperExecPath::getHelperExecutable(QString basename)
 {
-    QStringList execs = getHelperExecutables(basename);
+    auto execs = getHelperExecutables(basename);
     if (execs.empty()) return "";
-    else return execs[0];
+    else return execs[0].executable;
 }
 
 QStringList
@@ -69,7 +73,7 @@
     return candidates;
 }
 
-QStringList
+QList<HelperExecPath::HelperExec>
 HelperExecPath::search(QString basename, QStringList &candidates)
 {
     // Helpers are expected to exist either in the same directory as
@@ -80,15 +84,17 @@
     extension = ".exe";
 #endif
 
-    QStringList executables;
+    QList<HelperExec> executables;
     QStringList dirs = getHelperDirPaths();
     
-    for (QString s: getSuffixes()) {
+    for (QString t: getTags()) {
         for (QString d: dirs) {
-            QString path = d + QDir::separator() + basename + s + extension;
+            QString path = d + QDir::separator() + basename;
+            if (t != QString()) path += "-" + t;
+            path += extension;
             candidates.push_back(path);
             if (isGood(path)) {
-                executables.push_back(path);
+                executables.push_back({ path, t });
                 break;
             }
         }