Android: Fix env vars parsing
env var values might contain '=' char, so we can't use split. Change-Id: Iedf3ea46a847acaaf02f51bc80586a519fe7a310 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
c00487d588
commit
77160d2923
@ -454,9 +454,9 @@ static jboolean startQtAndroidPlugin(JNIEnv *env, jobject /*object*/, jstring pa
|
|||||||
const QList<QByteArray> envVars = QByteArray(nativeString).split('\t');
|
const QList<QByteArray> envVars = QByteArray(nativeString).split('\t');
|
||||||
env->ReleaseStringUTFChars(environmentString, nativeString);
|
env->ReleaseStringUTFChars(environmentString, nativeString);
|
||||||
for (const QByteArray &envVar : envVars) {
|
for (const QByteArray &envVar : envVars) {
|
||||||
const QList<QByteArray> envVarPair = envVar.split('=');
|
int pos = envVar.indexOf('=');
|
||||||
if (envVarPair.size() == 2 && ::setenv(envVarPair[0], envVarPair[1], 1) != 0)
|
if (pos != -1 && ::setenv(envVar.left(pos), envVar.mid(pos + 1), 1) != 0)
|
||||||
qWarning() << "Can't set environment" << envVarPair;
|
qWarning() << "Can't set environment" << envVar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user