Utils: Remove one spurious static function from QtcProcess

The next one could probably be merged into FilePath::searchInPath

Change-Id: If32fe77fb19b628a44d212bb8420443bd4f04899
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2022-06-16 16:50:14 +02:00
parent 3156c33d12
commit f7e9623369
3 changed files with 7 additions and 10 deletions

View File

@@ -1617,12 +1617,6 @@ void QtcProcess::stop()
d->m_killTimer.start(d->m_process->m_setup.m_reaperTimeout);
}
QString QtcProcess::locateBinary(const QString &binary)
{
const QByteArray path = qgetenv("PATH");
return locateBinary(QString::fromLocal8Bit(path), binary);
}
/*!
\class Utils::SynchronousProcess

View File

@@ -144,10 +144,10 @@ public:
// These (or some of them) may be potentially moved outside of the class.
// For some we may aggregate in another public utils class (or subclass of QtcProcess)?
// TODO: How below 3 methods relate to QtcProcess? Action: move them somewhere else.
// TODO: How below 2 methods relate to QtcProcess?
// Action: move/merge them somewhere else, FilePath::searchInPath() ?
// Helpers to find binaries. Do not use it for other path variables
// and file types.
static QString locateBinary(const QString &binary);
static QString locateBinary(const QString &path, const QString &binary);
static QString normalizeNewlines(const QString &text);

View File

@@ -170,8 +170,11 @@ bool ExternalQtEditor::getEditorLaunchData(const Utils::FilePath &filePath,
qtVersionsToCheck = Utils::filteredUnique(qtVersionsToCheck); // can still contain nullptr
data->binary = findFirstCommand(qtVersionsToCheck, m_commandForQtVersion);
// fallback
if (data->binary.isEmpty())
data->binary = Utils::QtcProcess::locateBinary(m_commandForQtVersion(nullptr));
if (data->binary.isEmpty()) {
const QString path = qEnvironmentVariable("PATH");
data->binary = Utils::QtcProcess::locateBinary(path, m_commandForQtVersion(nullptr));
}
if (data->binary.isEmpty()) {
*errorMessage = msgAppNotFound(id().toString());
return false;