Skip to content
GitLab
Menu
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
ad008b9b
Commit
ad008b9b
authored
Oct 06, 2010
by
Tobias Hunger
Browse files
Environment: Disable escaping when expanding variables
This breaks too much on windows. Reviewed-by: dt
parent
f3dfc891
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/libs/utils/environment.cpp
View file @
ad008b9b
...
...
@@ -373,20 +373,15 @@ QString Environment::joinArgumentList(const QStringList &arguments)
return
result
;
}
enum
State
{
BASE
,
VARIABLE
,
OPTIONALVARIABLEBRACE
,
STRING
,
STRING_ESCAPE
,
ESCAPE
};
enum
State
{
BASE
,
VARIABLE
,
OPTIONALVARIABLEBRACE
,
STRING
};
/** Expand environment variables in a string.
*
* Environment variables are accepted in the following forms:
* $SOMEVAR, ${SOMEVAR} and %SOMEVAR%.
*
* The following escape sequences are supported:
* "\$", "\\" and "\"" which will be replaced by '$', '\' and '%'
* respectively.
*
* Strings enclosed in '"' characters do not get varaibles
* substituted. Escape codes are processed though.
*
* substituted.
*/
QString
Environment
::
expandVariables
(
const
QString
&
input
)
const
{
...
...
@@ -399,9 +394,7 @@ QString Environment::expandVariables(const QString &input) const
for
(
int
i
=
0
;
i
<
length
;
++
i
)
{
QChar
c
=
input
.
at
(
i
);
if
(
state
==
BASE
)
{
if
(
c
==
'\\'
)
{
state
=
ESCAPE
;
}
else
if
(
c
==
'$'
)
{
if
(
c
==
'$'
)
{
state
=
OPTIONALVARIABLEBRACE
;
variable
.
clear
();
endVariable
=
QChar
(
0
);
...
...
@@ -433,20 +426,12 @@ QString Environment::expandVariables(const QString &input) const
variable
=
c
;
state
=
VARIABLE
;
}
else
if
(
state
==
STRING
)
{
if
(
c
==
'\\'
)
{
state
=
STRING_ESCAPE
;
}
else
if
(
c
==
'\"'
)
{
if
(
c
==
'\"'
)
{
state
=
BASE
;
result
+=
c
;
}
else
{
result
+=
c
;
}
}
else
if
(
state
==
STRING_ESCAPE
)
{
result
+=
c
;
state
=
STRING
;
}
else
if
(
state
==
ESCAPE
){
result
+=
c
;
state
=
BASE
;
}
}
if
(
state
==
VARIABLE
)
...
...
src/libs/utils/pathchooser.cpp
View file @
ad008b9b
...
...
@@ -110,9 +110,7 @@ QString PathChooserPrivate::expandedPath(const QString &input) const
{
if
(
input
.
isEmpty
())
return
input
;
// Environment does \-expansion, too.
const
QString
nativeInput
=
QDir
::
fromNativeSeparators
(
input
);
const
QString
path
=
QDir
::
fromNativeSeparators
(
m_environment
.
expandVariables
(
nativeInput
));
const
QString
path
=
QDir
::
fromNativeSeparators
(
m_environment
.
expandVariables
(
input
));
if
(
path
.
isEmpty
())
return
path
;
...
...
src/plugins/projectexplorer/abstractprocessstep.cpp
View file @
ad008b9b
...
...
@@ -151,13 +151,12 @@ void AbstractProcessStep::run(QFutureInterface<bool> &fi)
fi
.
reportResult
(
true
);
return
;
}
QString
workDir
=
m_environment
.
expandVariables
(
m_workingDirectory
);
QDir
wd
(
workDir
);
QDir
wd
(
m_environment
.
expandVariables
(
m_workingDirectory
));
if
(
!
wd
.
exists
())
wd
.
mkpath
(
wd
.
absolutePath
());
m_process
=
new
QProcess
();
m_process
->
setWorkingDirectory
(
w
orkDir
);
m_process
->
setWorkingDirectory
(
w
d
.
absolutePath
()
);
m_process
->
setEnvironment
(
m_environment
.
toStringList
());
connect
(
m_process
,
SIGNAL
(
readyReadStandardOutput
()),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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