Changeset View
Changeset View
Standalone View
Standalone View
plugins/docker/dockerruntime.cpp
Show First 20 Lines • Show All 243 Lines • ▼ Show 20 Line(s) | 232 | for (auto project : projects) { | |||
---|---|---|---|---|---|
244 | } | 244 | } | ||
245 | } | 245 | } | ||
246 | qCWarning(DOCKER) << "only project files are accessible on the docker runtime" << localPath; | 246 | qCWarning(DOCKER) << "only project files are accessible on the docker runtime" << localPath; | ||
247 | } | 247 | } | ||
248 | qCDebug(DOCKER) << "bypass..." << localPath; | 248 | qCDebug(DOCKER) << "bypass..." << localPath; | ||
249 | return localPath; | 249 | return localPath; | ||
250 | } | 250 | } | ||
251 | 251 | | |||
252 | QString DockerRuntime::findExecutable(const QString& executableName, | ||||
253 | const QStringList& paths) const { | ||||
mwolff: open brace on its own line | |||||
254 | QStringList rtPaths; | ||||
255 | | ||||
256 | if(paths.empty()) { | ||||
all I said in the android runtime applies here too I believe also, the code is identical, so share it trough some "runtime helper header" mwolff: all I said in the android runtime applies here too I believe
also, the code is identical, so… | |||||
Where to put it? arrowd: > also, the code is identical, so share it trough some "runtime helper header"
Where to put it? | |||||
hmm good question. but see my comment above - since paths is never filled, we can simplify this code a lot and then the code duplication is potentially not that bad anymore. but I would be OK with a trivial runtimehelpers.h with an inline implementation of this function for now. bonus points if you make this a proper static lib mwolff: hmm good question. but see my comment above - since paths is never filled, we can simplify this… | |||||
257 | auto envPaths = getenv("PATH").split(':'); | ||||
258 | std::transform(envPaths.begin(), envPaths.end(), rtPaths.begin(), | ||||
all duplicated code paths that use transform will crash: you have to resize rtPaths to the correct size, or use a back_inserter mwolff: all duplicated code paths that use transform will crash: you have to resize rtPaths to the… | |||||
259 | [](QByteArray p) { | ||||
260 | return QString::fromLocal8Bit(p); | ||||
261 | }); | ||||
262 | } | ||||
263 | else { | ||||
264 | std::transform(paths.begin(), paths.end(), rtPaths.begin(), | ||||
265 | [this](QString p) { | ||||
266 | return pathInHost(Path(p)).toLocalFile(); | ||||
267 | }); | ||||
268 | } | ||||
269 | | ||||
270 | return QStandardPaths::findExecutable(executableName, paths); | ||||
271 | } | ||||
272 | |
open brace on its own line