From ecbc703261919b0e1536b2177dcbe8ddc101b218 Mon Sep 17 00:00:00 2001 From: malte_langkabel Date: Wed, 11 Jan 2017 14:54:06 +0100 Subject: [PATCH] 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 --- src/lib/utility/file/FilePath.cpp | 4 ++-- web/documentation/index.html | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/utility/file/FilePath.cpp b/src/lib/utility/file/FilePath.cpp index 8bd17c0c..4914bcaa 100644 --- a/src/lib/utility/file/FilePath.cpp +++ b/src/lib/utility/file/FilePath.cpp @@ -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"); diff --git a/web/documentation/index.html b/web/documentation/index.html index b6ef5756..8d6e7643 100644 --- a/web/documentation/index.html +++ b/web/documentation/index.html @@ -558,6 +558,8 @@

Path List Box

The Path List Box is a user interface element that is used within the Preferences Window and the Project Setup Wizard. It allows for entering a list of file and directory paths.

+

If you want to use environment variables you can use either of the following notations.

+
${VARIABLE_NAME} or %VARIABLE_NAME%