Changeset View
Changeset View
Standalone View
Standalone View
plugins/android/androidruntime.cpp
Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Line(s) | 78 | { | |||
---|---|---|---|---|---|
84 | qCDebug(ANDROID) << "starting kprocess" << process->program().join(QLatin1Char(' ')); | 84 | qCDebug(ANDROID) << "starting kprocess" << process->program().join(QLatin1Char(' ')); | ||
85 | process->start(); | 85 | process->start(); | ||
86 | } | 86 | } | ||
87 | 87 | | |||
88 | QByteArray AndroidRuntime::getenv(const QByteArray &varname) const | 88 | QByteArray AndroidRuntime::getenv(const QByteArray &varname) const | ||
89 | { | 89 | { | ||
90 | return qgetenv(varname.constData()); | 90 | return qgetenv(varname.constData()); | ||
91 | } | 91 | } | ||
92 | | ||||
93 | QString AndroidRuntime::findExecutable(const QString& executableName, | ||||
94 | const QStringList& paths) const { | ||||
95 | QStringList rtPaths; | ||||
96 | | ||||
97 | if(paths.empty()) { | ||||
98 | auto envPaths = getenv("PATH").split(':'); | ||||
mwolff: @arrowd the PATH list here should still be going through `pathInHost`, otherwise it will point… | |||||
getenv there is IRuntime::getenv(). If I understand it right, it returns paths inside the RT, just what we need. arrowd: `getenv` there is `IRuntime::getenv()`. If I understand it right, it returns paths inside the… | |||||
yes, a path in the runtime is by definition not a pathInHost. So getenv("PATH") will give use e.g. /usr/bin but then we need to map that into, say, /opt/android/something/usr/bin, no? also, I just notice: please use QByteArrayLiteral around "PATH" mwolff: yes, a path in the runtime is by definition not a `pathInHost`. So `getenv("PATH")` will give… | |||||
99 | std::transform(envPaths.begin(), envPaths.end(), rtPaths.begin(), | ||||
100 | [](QByteArray p) { | ||||
101 | return QString::fromLocal8Bit(p); | ||||
102 | }); | ||||
103 | } | ||||
104 | else { | ||||
105 | std::transform(paths.begin(), paths.end(), rtPaths.begin(), | ||||
106 | [this](QString p) { | ||||
107 | return pathInHost(Path(p)).toLocalFile(); | ||||
108 | }); | ||||
109 | } | ||||
110 | | ||||
111 | return QStandardPaths::findExecutable(executableName, paths); | ||||
112 | } |
@arrowd the PATH list here should still be going through pathInHost, otherwise it will point to the wrong directories. so it would be something like:
@apol how would you implement this?