changeset 214:478d0222e93d

* Further findInPath fix for absolute paths
author Chris Cannam
date Wed, 05 Jan 2011 16:20:20 +0000
parents 90e70a9024f3
children 12b2bd530bd6
files common.cpp
diffstat 1 files changed, 16 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/common.cpp	Wed Jan 05 16:08:37 2011 +0000
+++ b/common.cpp	Wed Jan 05 16:20:20 2011 +0000
@@ -59,10 +59,10 @@
             name = QFileInfo(name).fileName();
             QString path =
                 QProcessEnvironment::systemEnvironment().value("PATH");
-            DEBUG << "findExecutable: seeking location for binary " << name
+            DEBUG << "findInPath: seeking location for binary " << name
                   << ": system path is " << path << endl;
             if (installPath != "") {   
-                DEBUG << "findExecutable: install path is " << installPath
+                DEBUG << "findInPath: install path is " << installPath
                       << ", adding to system path" << endl;
                 //!!! path = path + pathSep + installPath;
                 path = installPath + pathSep + path;
@@ -77,17 +77,28 @@
             foreach (QString element, elements) {
                 QString full = QDir(element).filePath(name);
                 QFileInfo fi(full);
-                DEBUG << "findExecutable: looking at " << full << endl;
+                DEBUG << "findInPath: looking at " << full << endl;
                 if (fi.exists() && fi.isFile()) {
-                    DEBUG << "findExecutable: it's a file" << endl;
+                    DEBUG << "findInPath: it's a file" << endl;
                     if (!executableRequired || fi.isExecutable()) {
                         name = full;
-                        DEBUG << "findExecutable: found at " << name << endl;
+                        DEBUG << "findInPath: found at " << name << endl;
                         found = true;
                         break;
                     }
                 }
             }
+        } else {
+            // absolute path given
+            QFileInfo fi(name);
+            DEBUG << "findInPath: looking at absolute path " << name << endl;
+            if (fi.exists() && fi.isFile()) {
+                DEBUG << "findInPath: it's a file" << endl;
+                if (!executableRequired || fi.isExecutable()) {
+                    DEBUG << "findInPath: found at " << name << endl;
+                    found = true;
+                }
+            }
         }
     }
 #ifdef Q_OS_WIN32