logic: fixed environment variable detection

* fixed detection of environment variables in path that are encapsulated in %VARIABLE_NAME%
* mentioned notation for environment variables in documentation
This commit is contained in:
malte_langkabel
2017-01-11 14:54:06 +01:00
parent a8ca0660fa
commit ecbc703261
2 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -121,11 +121,11 @@ FilePath FilePath::expandEnvironmentVariables() const
{
std::string text = str();
static std::regex env("\\$\\{([^}]+)\\}|%([0-9A-Za-z\\/]*)%");
static std::regex env("\\$\\{([^}]+)\\}|%([^%]+)%"); // ${VARIABLE_NAME} or %VARIABLE_NAME%
std::smatch match;
while (std::regex_search(text, match, env))
{
const char * s = getenv(match[1].str().c_str());
const char * s = match[1].matched ? getenv(match[1].str().c_str()) : getenv(match[2].str().c_str());
if (s == nullptr)
{
LOG_ERROR(match[1].str() + " is no a environment variable");
+2
View File
@@ -558,6 +558,8 @@
<h3>Path List Box</h3>
<p>The Path List Box is a user interface element that is used within the <a href="#PreferencesWindow">Preferences Window</a> and the <a href="#ProjectSetupWizard">Project Setup Wizard</a>. It allows for entering a list of file and directory paths.</p>
<p>If you want to use environment variables you can use either of the following notations.</p>
<pre>${VARIABLE_NAME} or %VARIABLE_NAME%</pre>
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<img src="img/path_list_box.png" style="width:100%;">