Commit 85d3cc84 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Environment: Don't search the same directory repeatedly

Do not search the same directory repeatedly when looking for binaries.

Change-Id: I97a722cfa689224cb85cdadfd02e283247f96325
Reviewed-by: default avatarOrgad Shaneh <>
Reviewed-by: default avatarDaniel Teske <>
parent bbe35e19
......@@ -31,6 +31,7 @@
#include <QDir>
#include <QProcessEnvironment>
#include <QSet>
#include <QCoreApplication>
class SystemEnvironment : public Utils::Environment
......@@ -262,7 +263,11 @@ QString Environment::searchInPath(const QString &executable,
if (fi.isAbsolute())
return exec;
QSet<QString> alreadyChecked;
foreach (const QString &dir, additionalDirs) {
if (alreadyChecked.contains(dir))
QString tmp = searchInDirectory(execs, dir);
if (!tmp.isEmpty())
return tmp;
......@@ -272,6 +277,9 @@ QString Environment::searchInPath(const QString &executable,
return QString();
foreach (const QString &p, path()) {
if (alreadyChecked.contains(p))
QString tmp = searchInDirectory(execs, QDir::fromNativeSeparators(p));
if (!tmp.isEmpty())
return tmp;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment