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& name)
64#ifdef LASS_UTIL_IMPL_HAVE_ENV_S
66 LASS_ENFORCE_CLIB_RC(getenv_s(&size, 0, 0, name.c_str()));
69 LASS_THROW_EX(KeyError,
"Could not find environment variable '" << name <<
"'.");
71 std::vector<char> buffer(size);
72 LASS_ENFORCE_CLIB_RC(getenv_s(&size, &buffer[0], size, name.c_str()));
73 return std::string(&buffer[0]);
75 const char* result = getenv(name.c_str());
78 LASS_THROW_EX(KeyError,
"Could not find environment variable '" << name <<
"'.");
80 return std::string(result);
84void lass_putenv(
const std::string& name,
const std::string& value)
86#ifdef LASS_UTIL_IMPL_HAVE_ENV_S
87 LASS_ENFORCE_CLIB_RC(_putenv_s(name.c_str(), value.c_str()));
89 LASS_ENFORCE_CLIB(setenv(name.c_str(), value.c_str(), 1));
general utility, debug facilities, ...
Library for Assembled Shared Sources.