forked from qt-creator/qt-creator
Maemo: Fix Qemu libpath parsing.
There can now be more than one variable be set. Reviewed-by: kh1
This commit is contained in:
@@ -371,10 +371,10 @@ void MaemoQemuManager::startRuntime()
|
||||
const QLatin1String key("PATH");
|
||||
env.insert(key, root % QLatin1String("bin") % colon % env.value(key));
|
||||
env.insert(key, root % QLatin1String("madlib") % colon % env.value(key));
|
||||
#elif defined(Q_OS_UNIX)
|
||||
const QLatin1String key("LD_LIBRARY_PATH");
|
||||
env.insert(key, env.value(key) % QLatin1Char(':') % rt.m_libPath);
|
||||
#endif
|
||||
for (QHash<QString, QString>::ConstIterator it = rt.m_environment.constBegin();
|
||||
it != rt.m_environment.constEnd(); ++it)
|
||||
env.insert(it.key(), it.value());
|
||||
m_qemuProcess->setProcessEnvironment(env);
|
||||
m_qemuProcess->setWorkingDirectory(rt.m_root);
|
||||
|
||||
@@ -643,9 +643,7 @@ bool MaemoQemuManager::fillRuntimeInformation(Runtime *runtime) const
|
||||
|
||||
runtime->m_bin = map.value(QLatin1String("qemu"));
|
||||
runtime->m_args = map.value(QLatin1String("qemu_args"));
|
||||
const QString &libPathSpec = map.value(QLatin1String("libpath"));
|
||||
runtime->m_libPath =
|
||||
libPathSpec.mid(libPathSpec.indexOf(QLatin1Char('=')) + 1);
|
||||
setEnvironment(runtime, map.value(QLatin1String("libpath")));
|
||||
runtime->m_sshPort = map.value(QLatin1String("sshport"));
|
||||
runtime->m_freePorts = MaemoPortList();
|
||||
int i = 2;
|
||||
@@ -662,6 +660,35 @@ bool MaemoQemuManager::fillRuntimeInformation(Runtime *runtime) const
|
||||
return false;
|
||||
}
|
||||
|
||||
void MaemoQemuManager::setEnvironment(Runtime *runTime,
|
||||
const QString &envSpec) const
|
||||
{
|
||||
QString remainingEnvSpec = envSpec;
|
||||
QString currentKey;
|
||||
while (true) {
|
||||
const int nextEqualsSignPos
|
||||
= remainingEnvSpec.indexOf(QLatin1Char('='));
|
||||
if (nextEqualsSignPos == -1) {
|
||||
if (!currentKey.isEmpty())
|
||||
runTime->m_environment.insert(currentKey, remainingEnvSpec);
|
||||
break;
|
||||
}
|
||||
const int keyStartPos
|
||||
= remainingEnvSpec.lastIndexOf(QRegExp(QLatin1String("\\s")),
|
||||
nextEqualsSignPos) + 1;
|
||||
if (!currentKey.isEmpty()) {
|
||||
const int valueEndPos
|
||||
= remainingEnvSpec.lastIndexOf(QRegExp(QLatin1String("\\S")),
|
||||
qMax(0, keyStartPos - 1)) + 1;
|
||||
runTime->m_environment.insert(currentKey,
|
||||
remainingEnvSpec.left(valueEndPos));
|
||||
}
|
||||
currentKey = remainingEnvSpec.mid(keyStartPos,
|
||||
nextEqualsSignPos - keyStartPos);
|
||||
remainingEnvSpec.remove(0, nextEqualsSignPos + 1);
|
||||
}
|
||||
}
|
||||
|
||||
QString MaemoQemuManager::runtimeForQtVersion(const QString &qmakeCommand) const
|
||||
{
|
||||
const QString &target = targetRoot(qmakeCommand);
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "maemoconstants.h"
|
||||
#include "maemodeviceconfigurations.h"
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QProcess>
|
||||
@@ -67,9 +68,9 @@ struct Runtime
|
||||
QString m_bin;
|
||||
QString m_root;
|
||||
QString m_args;
|
||||
QString m_libPath;
|
||||
QString m_sshPort;
|
||||
QString m_watchPath;
|
||||
QHash<QString, QString> m_environment;
|
||||
MaemoPortList m_freePorts;
|
||||
};
|
||||
|
||||
@@ -134,6 +135,7 @@ private:
|
||||
QString targetRoot(const QString &qmake) const;
|
||||
|
||||
bool fillRuntimeInformation(Runtime *runtime) const;
|
||||
void setEnvironment(Runtime *runTime, const QString &envSpec) const;
|
||||
QString runtimeForQtVersion(const QString &qmakeCommand) const;
|
||||
|
||||
void notify(const QList<int> uniqueIds);
|
||||
|
||||
Reference in New Issue
Block a user