|
|
@ -538,14 +538,16 @@ SPDLOG_INLINE filename_t dir_name(filename_t path)
|
|
|
|
|
|
|
|
|
|
|
|
std::string SPDLOG_INLINE getenv(const char *field)
|
|
|
|
std::string SPDLOG_INLINE getenv(const char *field)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#if defined(__cplusplus_winrt)
|
|
|
|
#if defined(__cplusplus_winrt)
|
|
|
|
SPDLOG_THROW(spdlog_ex("getenv is not supported under uwp"));
|
|
|
|
return std::string{}; //not supported under uwp
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#if defined(_MSC_VER) && !defined(__cplusplus_winrt)
|
|
|
|
|
|
|
|
size_t len = 0;
|
|
|
|
size_t len = 0;
|
|
|
|
char buf[128];
|
|
|
|
char buf[128];
|
|
|
|
bool ok = ::getenv_s(&len, buf, sizeof(buf), field) == 0;
|
|
|
|
bool ok = ::getenv_s(&len, buf, sizeof(buf), field) == 0;
|
|
|
|
return ok ? buf : std::string{};
|
|
|
|
return ok ? buf : std::string{};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#else // revert to getenv
|
|
|
|
#else // revert to getenv
|
|
|
|
char *buf = ::getenv(field);
|
|
|
|
char *buf = ::getenv(field);
|
|
|
|
return buf ? buf : std::string{};
|
|
|
|
return buf ? buf : std::string{};
|
|
|
|