Changeset View
Changeset View
Standalone View
Standalone View
plugins/flatpak/flatpakruntime.cpp
Show First 20 Lines • Show All 224 Lines • ▼ Show 20 Line(s) | 223 | if (bdfiles.isParentOf(localPath)) { | |||
---|---|---|---|---|---|
225 | ret = Path(Path(QStringLiteral("/app")), relpath); | 225 | ret = Path(Path(QStringLiteral("/app")), relpath); | ||
226 | } | 226 | } | ||
227 | } | 227 | } | ||
228 | 228 | | |||
229 | qCDebug(FLATPAK) << "path in runtime" << localPath << ret; | 229 | qCDebug(FLATPAK) << "path in runtime" << localPath << ret; | ||
230 | return ret; | 230 | return ret; | ||
231 | } | 231 | } | ||
232 | 232 | | |||
233 | QString FlatpakRuntime::findExecutable(const QString& executableName, | ||||
234 | const QStringList& paths) const { | ||||
235 | QStringList rtPaths; | ||||
mwolff: dito | |||||
236 | | ||||
237 | if(paths.empty()) { | ||||
238 | auto envPaths = getenv("PATH").split(':'); | ||||
239 | std::transform(envPaths.begin(), envPaths.end(), rtPaths.begin(), | ||||
240 | [](QByteArray p) { | ||||
241 | return QString::fromLocal8Bit(p); | ||||
242 | }); | ||||
243 | } | ||||
244 | else { | ||||
245 | std::transform(paths.begin(), paths.end(), rtPaths.begin(), | ||||
246 | [this](QString p) { | ||||
247 | return pathInHost(Path(p)).toLocalFile(); | ||||
248 | }); | ||||
249 | } | ||||
250 | | ||||
251 | return QStandardPaths::findExecutable(executableName, paths); | ||||
252 | } | ||||
253 | | ||||
233 | QByteArray FlatpakRuntime::getenv(const QByteArray& varname) const | 254 | QByteArray FlatpakRuntime::getenv(const QByteArray& varname) const | ||
234 | { | 255 | { | ||
235 | if (varname == "KDEV_DEFAULT_INSTALL_PREFIX") | 256 | if (varname == "KDEV_DEFAULT_INSTALL_PREFIX") | ||
236 | return "/app"; | 257 | return "/app"; | ||
237 | return qgetenv(varname.constData()); | 258 | return qgetenv(varname.constData()); | ||
238 | } | 259 | } | ||
239 | 260 | | |||
240 | KDevelop::Path FlatpakRuntime::buildPath() const | 261 | KDevelop::Path FlatpakRuntime::buildPath() const | ||
241 | { | 262 | { | ||
242 | auto file = m_file; | 263 | auto file = m_file; | ||
243 | file.setLastPathSegment(QStringLiteral(".flatpak-builder")); | 264 | file.setLastPathSegment(QStringLiteral(".flatpak-builder")); | ||
244 | file.addPath(QStringLiteral("kdevelop")); | 265 | file.addPath(QStringLiteral("kdevelop")); | ||
245 | return file; | 266 | return file; | ||
246 | } | 267 | } |
dito