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");