47# include "lass_auto_config.h"
51#if LASS_PLATFORM_TYPE == LASS_PLATFORM_TYPE_WIN32
52# define LASS_UTIL_IMPL_HAVE_ENV_S
62const std::string lass_getenv(
const std::string& iName)
64#ifdef LASS_UTIL_IMPL_HAVE_ENV_S
66 LASS_ENFORCE_CLIB_RC(getenv_s(&size, 0, 0, iName.c_str()));
69 LASS_THROW(
"Could not find environment variable '" << iName <<
"'.");
71 std::vector<char> buffer(size);
72 LASS_ENFORCE_CLIB_RC(getenv_s(&size, &buffer[0], size, iName.c_str()));
73 return std::string(&buffer[0]);
75 const char* result = getenv(iName.c_str());
78 LASS_THROW(
"Could not find environment variable '" << iName <<
"'.");
80 return std::string(result);
84void lass_putenv(
const std::string& iName,
const std::string& iValue)
86#ifdef LASS_UTIL_IMPL_HAVE_ENV_S
87 LASS_ENFORCE_CLIB_RC(_putenv_s(iName.c_str(), iValue.c_str()));
89 std::stringstream buffer;
90 buffer << iName <<
"=" << iValue;
91 LASS_ENFORCE_CLIB_RC(
putenv(
const_cast<char*
>(buffer.str().c_str())));
void putenv(const std::string &key, const std::string &value)
os.environ[key] = value
general utility, debug facilities, ...
Library for Assembled Shared Sources.