forked from qt-creator/qt-creator
expand $()-style env vars in some more places like qmake does
Task-number: QTCREATORBUG-229
This commit is contained in:
@@ -968,7 +968,7 @@ static QStringList expandEnvVars(const QStringList &x)
|
|||||||
// This is braindead, but we want qmake compat
|
// This is braindead, but we want qmake compat
|
||||||
static QString fixPathToLocalOS(const QString &str)
|
static QString fixPathToLocalOS(const QString &str)
|
||||||
{
|
{
|
||||||
QString string = str;
|
QString string = expandEnvVars(str);
|
||||||
|
|
||||||
if (string.length() > 2 && string.at(0).isLetter() && string.at(1) == QLatin1Char(':'))
|
if (string.length() > 2 && string.at(0).isLetter() && string.at(1) == QLatin1Char(':'))
|
||||||
string[0] = string[0].toLower();
|
string[0] = string[0].toLower();
|
||||||
@@ -2070,7 +2070,7 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun
|
|||||||
if (args.count() > 1)
|
if (args.count() > 1)
|
||||||
singleLine = (!args[1].compare(statics.strtrue, Qt::CaseInsensitive));
|
singleLine = (!args[1].compare(statics.strtrue, Qt::CaseInsensitive));
|
||||||
|
|
||||||
QFile qfile(resolvePath(file));
|
QFile qfile(resolvePath(expandEnvVars(file)));
|
||||||
if (qfile.open(QIODevice::ReadOnly)) {
|
if (qfile.open(QIODevice::ReadOnly)) {
|
||||||
QTextStream stream(&qfile);
|
QTextStream stream(&qfile);
|
||||||
while (!stream.atEnd()) {
|
while (!stream.atEnd()) {
|
||||||
@@ -2087,7 +2087,7 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun
|
|||||||
logMessage(format("fromfile(file, variable) requires two arguments."));
|
logMessage(format("fromfile(file, variable) requires two arguments."));
|
||||||
} else {
|
} else {
|
||||||
QHash<QString, QStringList> vars;
|
QHash<QString, QStringList> vars;
|
||||||
if (evaluateFileInto(resolvePath(args.at(0)), &vars, 0))
|
if (evaluateFileInto(resolvePath(expandEnvVars(args.at(0))), &vars, 0))
|
||||||
ret = vars.value(args.at(1));
|
ret = vars.value(args.at(1));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2372,7 +2372,7 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction(
|
|||||||
logMessage(format("infile(file, var, [values]) requires two or three arguments."));
|
logMessage(format("infile(file, var, [values]) requires two or three arguments."));
|
||||||
} else {
|
} else {
|
||||||
QHash<QString, QStringList> vars;
|
QHash<QString, QStringList> vars;
|
||||||
if (!evaluateFileInto(resolvePath(args.at(0)), &vars, 0))
|
if (!evaluateFileInto(resolvePath(expandEnvVars(args.at(0))), &vars, 0))
|
||||||
return ProItem::ReturnFalse;
|
return ProItem::ReturnFalse;
|
||||||
if (args.count() == 2)
|
if (args.count() == 2)
|
||||||
return returnBool(vars.contains(args.at(1)));
|
return returnBool(vars.contains(args.at(1)));
|
||||||
@@ -2702,7 +2702,7 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction(
|
|||||||
return ProItem::ReturnFalse;
|
return ProItem::ReturnFalse;
|
||||||
}
|
}
|
||||||
State sts = m_sts;
|
State sts = m_sts;
|
||||||
bool ok = evaluateFile(resolvePath(args.first()));
|
bool ok = evaluateFile(resolvePath(expandEnvVars(args.first())));
|
||||||
m_sts = sts;
|
m_sts = sts;
|
||||||
return returnBool(ok);
|
return returnBool(ok);
|
||||||
}
|
}
|
||||||
@@ -2719,7 +2719,7 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction(
|
|||||||
return ProItem::ReturnFalse;
|
return ProItem::ReturnFalse;
|
||||||
}
|
}
|
||||||
// XXX ignore_error unused
|
// XXX ignore_error unused
|
||||||
return returnBool(evaluateFeatureFile(args.first()));
|
return returnBool(evaluateFeatureFile(expandEnvVars(args.first())));
|
||||||
}
|
}
|
||||||
case T_DEBUG:
|
case T_DEBUG:
|
||||||
// Yup - do nothing. Nothing is going to enable debug output anyway.
|
// Yup - do nothing. Nothing is going to enable debug output anyway.
|
||||||
@@ -2765,8 +2765,7 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction(
|
|||||||
logMessage(format("exists(file) requires one argument."));
|
logMessage(format("exists(file) requires one argument."));
|
||||||
return ProItem::ReturnFalse;
|
return ProItem::ReturnFalse;
|
||||||
}
|
}
|
||||||
QString file = args.first();
|
QString file = resolvePath(expandEnvVars(args.first()));
|
||||||
file = fixPathToLocalOS(resolvePath(file));
|
|
||||||
|
|
||||||
if (IoUtils::exists(file)) {
|
if (IoUtils::exists(file)) {
|
||||||
return ProItem::ReturnTrue;
|
return ProItem::ReturnTrue;
|
||||||
|
|||||||
Reference in New Issue
Block a user