summaryrefslogtreecommitdiff
path: root/src/libs/utils/environment.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-10-19 11:14:03 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-11-17 13:19:07 +0100
commit1e362b0f8b0dfd712337df35cd26c5dc98dfc294 (patch)
treedbb61c65fc1c3e84b507e03c2b3f62a36acd6488 /src/libs/utils/environment.cpp
parent531c70f05bfc8355f856f2af41be533fb13b85e6 (diff)
downloadqt-creator-1e362b0f8b0dfd712337df35cd26c5dc98dfc294.tar.gz
overhaul process argument handling
get away from argument stringlists. instead, use native shell command lines which support quoting/splitting, environment variable expansion and redirections with well-understood semantics. Task-number: QTCREATORBUG-542 Task-number: QTCREATORBUG-1564
Diffstat (limited to 'src/libs/utils/environment.cpp')
-rw-r--r--src/libs/utils/environment.cpp56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/libs/utils/environment.cpp b/src/libs/utils/environment.cpp
index 03b7343592..34a8fa3aba 100644
--- a/src/libs/utils/environment.cpp
+++ b/src/libs/utils/environment.cpp
@@ -332,62 +332,6 @@ bool Environment::operator==(const Environment &other) const
return m_values == other.m_values;
}
-QStringList Environment::parseCombinedArgString(const QString &program)
-{
- QStringList args;
- QString tmp;
- int quoteCount = 0;
- bool inQuote = false;
-
- // handle quoting. tokens can be surrounded by double quotes
- // "hello world". three consecutive double quotes represent
- // the quote character itself.
- for (int i = 0; i < program.size(); ++i) {
- if (program.at(i) == QLatin1Char('"')) {
- ++quoteCount;
- if (quoteCount == 3) {
- // third consecutive quote
- quoteCount = 0;
- tmp += program.at(i);
- }
- continue;
- }
- if (quoteCount) {
- if (quoteCount == 1)
- inQuote = !inQuote;
- quoteCount = 0;
- }
- if (!inQuote && program.at(i).isSpace()) {
- if (!tmp.isEmpty()) {
- args += tmp;
- tmp.clear();
- }
- } else {
- tmp += program.at(i);
- }
- }
- if (!tmp.isEmpty())
- args += tmp;
- return args;
-}
-
-QString Environment::joinArgumentList(const QStringList &arguments)
-{
- QString result;
- const QChar doubleQuote = QLatin1Char('"');
- foreach (QString arg, arguments) {
- if (!result.isEmpty())
- result += QLatin1Char(' ');
- arg.replace(QString(doubleQuote), QLatin1String("\"\"\""));
- if (arg.contains(QLatin1Char(' '))) {
- arg.insert(0, doubleQuote);
- arg += doubleQuote;
- }
- result += arg;
- }
- return result;
-}
-
/** Expand environment variables in a string.
*
* Environment variables are accepted in the following forms: