diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp index 5612b2c8197..6c00b1d291c 100644 --- a/src/libs/utils/qtcprocess.cpp +++ b/src/libs/utils/qtcprocess.cpp @@ -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 diff --git a/src/libs/utils/qtcprocess.h b/src/libs/utils/qtcprocess.h index 8763bc14e26..8169e926b45 100644 --- a/src/libs/utils/qtcprocess.h +++ b/src/libs/utils/qtcprocess.h @@ -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); diff --git a/src/plugins/qmakeprojectmanager/externaleditors.cpp b/src/plugins/qmakeprojectmanager/externaleditors.cpp index 3d43bd45418..9d22c2ad0cf 100644 --- a/src/plugins/qmakeprojectmanager/externaleditors.cpp +++ b/src/plugins/qmakeprojectmanager/externaleditors.cpp @@ -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;