androiddeployqt: Don't detect directories as executable files
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Mon, 7 Oct 2013 08:20:47 +0000 (10:20 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 7 Oct 2013 20:42:39 +0000 (22:42 +0200)
When looking for an executable on the PATH we would mistakenly
report directories with the same filename (like "ant") as
the correct executable.

Task-number: QTBUG-33907
Change-Id: I7122e6f8da7a3027666e9dfc3040a17c2876e981
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
src/androiddeployqt/main.cpp

index 7ad97ac..bea1da0 100644 (file)
@@ -1518,7 +1518,8 @@ QString findInPath(const QString &fileName)
 
     QStringList paths = path.split(separator);
     foreach (QString path, paths) {
-        if (QFile::exists(path + QLatin1Char('/') + fileName))
+        QFileInfo fileInfo(path + QLatin1Char('/') + fileName);
+        if (fileInfo.exists() && fileInfo.isFile() && fileInfo.isExecutable())
             return path + QLatin1Char('/') + fileName;
     }