Commit f7240bd6 authored by dt's avatar dt
Browse files

Fixes: bin dir of msvc qt versions was not added to the path

The setting of msvc environments variables overwrote that. Fix that by running the script with the correct environment.
parent 6c0c75eb
/**************************************************************************
**
/**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
......@@ -51,6 +50,7 @@
#include <Lexer.h>
#include <Token.h>
#include <Literals.h>
#include <cctype>
#include <QtDebug>
#include <algorithm>
......
......@@ -34,6 +34,7 @@
#define _WIN32_WINNT 0x0501 /* WinXP, needed for DebugActiveProcessStop() */
#include <windows.h>
#include <shellapi.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
......
......@@ -288,6 +288,16 @@ void Environment::modify(const QList<EnvironmentItem> & list)
*this = resultEnvironment;
}
bool Environment::operator!=(const Environment &other)
{
return !(*this == other);
}
bool Environment::operator==(const Environment &other)
{
return m_values == other.m_values;
}
QStringList Environment::parseCombinedArgString(const QString &program)
{
QStringList args;
......@@ -341,3 +351,5 @@ QString Environment::joinArgumentList(const QStringList &arguments)
return result;
}
......@@ -89,6 +89,8 @@ public:
static QStringList parseCombinedArgString(const QString &program);
static QString joinArgumentList(const QStringList &arguments);
bool operator!=(const Environment &other);
bool operator==(const Environment &other);
private:
QMap<QString, QString> m_values;
};
......
......@@ -246,13 +246,13 @@ QList<HeaderPath> MSVCToolChain::systemHeaderPaths()
void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env)
{
if (!m_valuesSet) {
if (!m_valuesSet || env != m_lastEnvironment) {
m_lastEnvironment = env;
QSettings registry("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7",
QSettings::NativeFormat);
if (m_name.isEmpty())
return;
QString path = registry.value(m_name).toString();
ProjectExplorer::Environment oldEnv(env);
QString desc;
QString varsbat = path + "Common7\\Tools\\vsvars32.bat";
if (QFileInfo(varsbat).exists()) {
......@@ -265,7 +265,8 @@ void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env)
tf.flush();
tf.waitForBytesWritten(30000);
QProcess run; // TODO run in the environment we want to add to...
QProcess run;
run.setEnvironment(env.toStringList());
QString cmdPath = env.searchInPath("cmd");
run.start(cmdPath, QStringList()<<"/c"<<filename);
run.waitForFinished();
......@@ -281,9 +282,7 @@ void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env)
if (regexp.exactMatch(line2)) {
QString variable = regexp.cap(1);
QString value = regexp.cap(2);
value.replace('%' + variable + '%', oldEnv.value(variable));
m_values.append(QPair<QString, QString>(variable, value));
}
}
vars.close();
......@@ -293,14 +292,11 @@ void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env)
m_valuesSet = true;
}
//qDebug()<<"MSVC Environment:";
QList< QPair<QString, QString> >::const_iterator it, end;
end = m_values.constEnd();
for (it = m_values.constBegin(); it != end; ++it) {
env.set((*it).first, (*it).second);
//qDebug()<<"variable:"<<(*it).first<<"value:"<<(*it).second;
}
}
QString MSVCToolChain::makeCommand() const
......
......@@ -119,6 +119,7 @@ protected:
private:
mutable QList<QPair<QString, QString> > m_values;
mutable bool m_valuesSet;
mutable ProjectExplorer::Environment m_lastEnvironment;
};
// TODO some stuff needs to be moved into here
......
......@@ -1235,7 +1235,6 @@ void QtVersion::addToEnvironment(Environment &env)
// add libdir, includedir and bindir
// or add Mingw dirs
// or do nothing on other
}
int QtVersion::uniqueId() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment