| 21 | using namespace KDevelop; |
| 22 | |
| 23 | class IdentityRuntime : public IRuntime |
| 24 | { |
| 25 | Q_OBJECT |
| 26 | public: |
| 27 | QString name() const override { return i18n("Host System"); } |
| 28 | |
| 29 | void startProcess(KProcess *process) const override { |
| 30 | catchErrors(*process); |
| 31 | process->start(); |
| 32 | } |
| 33 | void startProcess(QProcess *process) const override { |
| 34 | catchErrors(*process); |
| 35 | process->start(); |
| 36 | } |
| 37 | KDevelop::Path pathInHost(const KDevelop::Path & runtimePath) const override { return runtimePath; } |
| 38 | KDevelop::Path pathInRuntime(const KDevelop::Path & localPath) const override { return localPath; } |
| 39 | QString findExecutable(const QString& executableName) const override |
| 40 | { |
| 41 | return QStandardPaths::findExecutable(executableName); |
| 42 | } |
| 43 | void setEnabled(bool /*enabled*/) override {} |
| 44 | QByteArray getenv(const QByteArray & varname) const override { return qgetenv(varname.constData()); } |
| 45 | KDevelop::Path buildPath() const override { return {}; } |
| 46 | |
| 47 | private: |
| 48 | static void catchErrors(const QProcess& process) |
| 49 | { |
| 50 | connect(&process, &QProcess::errorOccurred, [&process](QProcess::ProcessError error) { |
| 51 | qCWarning(SHELL).noquote().nospace() |
| 52 | << "process finished with error: " << error << " \"" << process.errorString() |
| 53 | << "\", the command line: \"" << KShell::quoteArg(process.program()) << ' ' |
| 54 | << KShell::joinArgs(process.arguments()) << '"'; |
| 55 | }); |
| 56 | } |
| 57 | }; |
| 58 | |
| 59 | KDevelop::RuntimeController::RuntimeController(KDevelop::Core* core) |
| 60 | : m_core(core) |