Commit f0c3f2ce authored by hjk's avatar hjk
Browse files

Variables: Use %{Env:SOME_NAME} to access environment variables

Change-Id: I2291e91608f9a93b7c886890a1e1039c5002f4ce
Reviewed-by: default avatarOrgad Shaneh <>
Reviewed-by: default avatarEike Ziller <>
parent bfbf9443
......@@ -81,6 +81,9 @@ public:
When the variable manager is requested to replace variables in a string, it looks for
variable names enclosed in %{ and }, like %{CurrentDocument:FilePath}.
Environment variables are accessible using the %{Env:...} notation.
For example, to access the SHELL environment variable, use %{Env:SHELL}.
\note The names of the variables are stored as QByteArray. They are typically
7-bit-clean. In cases where this is not possible, UTF-8 encoding is
......@@ -191,6 +194,12 @@ VariableManager::~VariableManager()
QString VariableManager::value(const QByteArray &variable, bool *found)
if (variable.startsWith("Env:")) {
QByteArray ba = qgetenv( + 4);
if (found)
*found = !ba.isNull();
return QString::fromLocal8Bit(ba);
if (found)
*found = d->m_map.contains(variable);
StringFunction f = d->m_map.value(variable);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment