OSDN Git Service

use environment from build config also when starting external processes
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Thu, 21 Apr 2011 09:36:37 +0000 (11:36 +0200)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Thu, 21 Apr 2011 09:38:23 +0000 (11:38 +0200)
this uses QProcessEnvironment directly, which is somewhat inefficient,
but it has no big impact, and it can be optimized on the qt side.

Task-number: QTCREATORBUG-2866

src/plugins/qt4projectmanager/qt4project.cpp
src/shared/proparser/profileevaluator.cpp
src/shared/proparser/profileevaluator.h

index 41de14d..bc6cb02 100644 (file)
@@ -895,11 +895,7 @@ ProFileReader *Qt4Project::createProFileReader(Qt4ProFileNode *qt4ProFileNode, Q
             Utils::Environment env = bc->environment();
             Utils::Environment::const_iterator eit = env.constBegin(), eend = env.constEnd();
             for (; eit != eend; ++eit)
-#ifdef Q_OS_WIN
-                m_proFileOption->environment.insert(env.key(eit).toUpper(), env.value(eit));
-#else
                 m_proFileOption->environment.insert(env.key(eit), env.value(eit));
-#endif
 
             QStringList args;
             if (QMakeStep *qs = bc->qmakeStep())
index 3d0d858..100d833 100644 (file)
@@ -48,9 +48,6 @@
 #include <QtCore/QString>
 #include <QtCore/QStringList>
 #include <QtCore/QTextStream>
-#ifndef QT_BOOTSTRAPPED
-# include <QtCore/QProcess>
-#endif
 #ifdef PROEVALUATOR_THREAD_SAFE
 # include <QtCore/QThreadPool>
 #endif
@@ -168,10 +165,8 @@ void ProFileOption::applyHostMode()
 
 QString ProFileOption::getEnv(const QString &var) const
 {
+#ifndef QT_BOOTSTRAPPED
     if (!environment.isEmpty())
-#ifdef Q_OS_WIN
-        return environment.value(var.toUpper());
-#else
         return environment.value(var);
 #endif
     return QString::fromLocal8Bit(qgetenv(var.toLocal8Bit().constData()));
@@ -1538,6 +1533,8 @@ void ProFileEvaluator::Private::runProcess(QProcess *proc, const QString &comman
                                            QProcess::ProcessChannel chan) const
 {
     proc->setWorkingDirectory(currentDirectory());
+    if (!m_option->environment.isEmpty())
+        proc->setProcessEnvironment(m_option->environment);
 # ifdef Q_OS_WIN
     proc->setNativeArguments(QLatin1String("/v:off /s /c \"") + command + QLatin1Char('"'));
     proc->start(m_option->getEnv(QLatin1String("COMSPEC")), QStringList());
index b6739dc..725664d 100644 (file)
@@ -37,6 +37,9 @@
 
 #include <QtCore/QHash>
 #include <QtCore/QStringList>
+#ifndef QT_BOOTSTRAPPED
+# include <QtCore/QProcess>
+#endif
 #ifdef PROEVALUATOR_THREAD_SAFE
 # include <QtCore/QMutex>
 # include <QtCore/QWaitCondition>
@@ -168,7 +171,9 @@ struct ProFileOption
     QString qmakespec;
     QString cachefile;
     QHash<QString, QString> properties;
-    QHash<QString, QString> environment;
+#ifndef QT_BOOTSTRAPPED
+    QProcessEnvironment environment;
+#endif
     QString sysroot;
 
     //QString pro_ext;