language-extensions/R/src/linux/Utilities_linux.cpp
//--------------------------------------------------------------------------------------------------
// Name: Utilities::GetEnvVariable
//
// Description:
//  Gets the value of the given environment variable name and if logError is true, logs an error
//  message if the variable is not found.
//
// Returns:
//  String value of the environment variable requested.
//
:GetEnvVariable
Description:
Gets the value of the given environment variable name and if logError is true, logs an error
message if the variable is not found.

String value of the environment variable requested.
: GetEnvVariable Description : Gets the value of the given environment variable name and if logError is true logs an error message if the variable is not found . String value of the environment variable requested .
string Utilities::GetEnvVariable(const string &envVarName, bool logError)
{
	string envVarValueString;
	char * envVarValue = getenv(envVarName.c_str());
	if (envVarValue != nullptr)
	{
		envVarValueString = string(const_cast<const char*>(envVarValue),
			strlen(envVarValue));
	}
	else if (logError)
	{
		LOG_ERROR("Did not find the environment variable " + envVarName);
	}
	return envVarValueString;
}
string Utilities :: GetEnvVariable ( const string & envVarName , bool logError ) { string envVarValueString ; char * envVarValue = getenv ( envVarName . c_str ( ) ) ; if ( envVarValue != nullptr ) { envVarValueString = string ( const_cast < const char * > ( envVarValue ) , strlen ( envVarValue ) ) ; } else if ( logError ) { LOG_ERROR ( " " + envVarName ) ; } return envVarValueString ; }
Name: Utilities::GetEnvVariable
Description:
Gets the value of the given environment variable name and if logError is true, logs an error
message if the variable is not found.
Name : Utilities :: GetEnvVariable Description : Gets the value of the given environment variable name and if logError is true logs an error message if the variable is not found .