forked from qt-creator/qt-creator
Autotest: Simplify ITestConfiguration::executableFilePath()
Change-Id: I7a3cdcc896b073a5cc24d00487902f4baff8719c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -83,21 +83,9 @@ FilePath ITestConfiguration::executableFilePath() const
|
|||||||
if (!hasExecutable())
|
if (!hasExecutable())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
if (m_runnable.command.executable().isExecutableFile() && m_runnable.command.executable().path() != ".") {
|
const Environment env = m_runnable.environment.size() == 0 ? Environment::systemEnvironment()
|
||||||
return m_runnable.command.executable().absoluteFilePath();
|
: m_runnable.environment;
|
||||||
} else if (m_runnable.command.executable().path() == "."){
|
return env.searchInPath(m_runnable.command.executable().path());
|
||||||
QString fullCommandFileName = m_runnable.command.executable().toString();
|
|
||||||
// TODO: check if we can use searchInPath() from Utils::Environment
|
|
||||||
const QStringList &pathList = m_runnable.environment.toProcessEnvironment().value("PATH")
|
|
||||||
.split(HostOsInfo::pathListSeparator());
|
|
||||||
|
|
||||||
for (const QString &path : pathList) {
|
|
||||||
QString filePath(path + QDir::separator() + fullCommandFileName);
|
|
||||||
if (QFileInfo(filePath).isExecutable())
|
|
||||||
return m_runnable.command.executable().absoluteFilePath();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Environment ITestConfiguration::filteredEnvironment(const Environment &original) const
|
Environment ITestConfiguration::filteredEnvironment(const Environment &original) const
|
||||||
|
Reference in New Issue
Block a user