Refacotor the code for parsing and expanding environment variables.

The old cold is copied from kio/kurlcompletion.cpp, which is not
very suitable for detecting and expanding environment variables. For
example, it only sees ' ' and '/' as the end point of an environment
variable. That assumption fails easily with the common example of
"PATH=$PATH:~/bin"
This commit is contained in:
Jekyll Wu
2012-06-05 04:45:07 +08:00
parent 1b5d9f9041
commit 2b8d544bce
4 changed files with 78 additions and 45 deletions

View File

@@ -84,7 +84,15 @@ public:
/** Expands environment variables in each string in @p list. */
static QStringList expand(const QStringList& items);
static bool isValidEnvCharacter(const QChar& ch);
static bool isValidLeadingEnvCharacter(const QChar& ch);
private:
static bool expandEnv(QString& text);
QStringList _arguments;
};
}