Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
07abc847
Commit
07abc847
authored
Feb 11, 2010
by
Oswald Buddenhagen
Browse files
expand $()-style env vars in some more places like qmake does
Task-number: QTCREATORBUG-229
parent
35bc0f36
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/shared/proparser/profileevaluator.cpp
View file @
07abc847
...
...
@@ -968,7 +968,7 @@ static QStringList expandEnvVars(const QStringList &x)
// This is braindead, but we want qmake compat
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
(
':'
))
string
[
0
]
=
string
[
0
].
toLower
();
...
...
@@ -2070,7 +2070,7 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun
if
(
args
.
count
()
>
1
)
singleLine
=
(
!
args
[
1
].
compare
(
statics
.
strtrue
,
Qt
::
CaseInsensitive
));
QFile
qfile
(
resolvePath
(
file
));
QFile
qfile
(
resolvePath
(
expandEnvVars
(
file
))
)
;
if
(
qfile
.
open
(
QIODevice
::
ReadOnly
))
{
QTextStream
stream
(
&
qfile
);
while
(
!
stream
.
atEnd
())
{
...
...
@@ -2087,7 +2087,7 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun
logMessage
(
format
(
"fromfile(file, variable) requires two arguments."
));
}
else
{
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
));
}
break
;
...
...
@@ -2372,7 +2372,7 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction(
logMessage
(
format
(
"infile(file, var, [values]) requires two or three arguments."
));
}
else
{
QHash
<
QString
,
QStringList
>
vars
;
if
(
!
evaluateFileInto
(
resolvePath
(
args
.
at
(
0
)),
&
vars
,
0
))
if
(
!
evaluateFileInto
(
resolvePath
(
expandEnvVars
(
args
.
at
(
0
))
)
,
&
vars
,
0
))
return
ProItem
::
ReturnFalse
;
if
(
args
.
count
()
==
2
)
return
returnBool
(
vars
.
contains
(
args
.
at
(
1
)));
...
...
@@ -2702,7 +2702,7 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction(
return
ProItem
::
ReturnFalse
;
}
State
sts
=
m_sts
;
bool
ok
=
evaluateFile
(
resolvePath
(
args
.
first
()));
bool
ok
=
evaluateFile
(
resolvePath
(
expandEnvVars
(
args
.
first
()))
)
;
m_sts
=
sts
;
return
returnBool
(
ok
);
}
...
...
@@ -2719,7 +2719,7 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction(
return
ProItem
::
ReturnFalse
;
}
// XXX ignore_error unused
return
returnBool
(
evaluateFeatureFile
(
args
.
first
()));
return
returnBool
(
evaluateFeatureFile
(
expandEnvVars
(
args
.
first
()))
)
;
}
case
T_DEBUG
:
// 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."
));
return
ProItem
::
ReturnFalse
;
}
QString
file
=
args
.
first
();
file
=
fixPathToLocalOS
(
resolvePath
(
file
));
QString
file
=
resolvePath
(
expandEnvVars
(
args
.
first
()));
if
(
IoUtils
::
exists
(
file
))
{
return
ProItem
::
ReturnTrue
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment