forked from qt-creator/qt-creator
move expandEnvVars() to QMakeGlobals
fits better there Change-Id: Id369d8e22db97affd03ed991433b898b110f1946 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -72,8 +72,27 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
#define fL1S(s) QString::fromLatin1(s)
|
||||
|
||||
namespace { // MSVC doesn't seem to know the semantics of "static" ...
|
||||
|
||||
static struct {
|
||||
QRegExp reg_variableName;
|
||||
} statics;
|
||||
|
||||
}
|
||||
|
||||
static void initStatics()
|
||||
{
|
||||
if (!statics.reg_variableName.isEmpty())
|
||||
return;
|
||||
|
||||
statics.reg_variableName.setPattern(QLatin1String("\\$\\(.*\\)"));
|
||||
statics.reg_variableName.setMinimal(true);
|
||||
}
|
||||
|
||||
QMakeGlobals::QMakeGlobals()
|
||||
{
|
||||
initStatics();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
dirlist_sep = QLatin1Char(';');
|
||||
dir_sep = QLatin1Char('\\');
|
||||
@@ -160,6 +179,17 @@ QStringList QMakeGlobals::getPathListEnv(const QString &var) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString QMakeGlobals::expandEnvVars(const QString &str) const
|
||||
{
|
||||
QString string = str;
|
||||
int rep;
|
||||
QRegExp reg_variableName = statics.reg_variableName; // Copy for thread safety
|
||||
while ((rep = reg_variableName.indexIn(string)) != -1)
|
||||
string.replace(rep, reg_variableName.matchedLength(),
|
||||
getEnv(string.mid(rep + 2, reg_variableName.matchedLength() - 3)));
|
||||
return string;
|
||||
}
|
||||
|
||||
#ifdef PROEVALUATOR_INIT_PROPS
|
||||
bool QMakeGlobals::initProperties(const QString &qmake)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user