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:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user