|
|
@ -563,21 +563,21 @@ SPDLOG_INLINE filename_t dir_name(const filename_t &path) {
|
|
|
|
return pos != filename_t::npos ? path.substr(0, pos) : filename_t{};
|
|
|
|
return pos != filename_t::npos ? path.substr(0, pos) : filename_t{};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
|
|
|
|
#pragma warning(push)
|
|
|
|
|
|
|
|
#pragma warning(disable : 4996)
|
|
|
|
|
|
|
|
#endif // _MSC_VER
|
|
|
|
std::string SPDLOG_INLINE getenv(const char *field) {
|
|
|
|
std::string SPDLOG_INLINE getenv(const char *field) {
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#if defined(_MSC_VER) && defined(__cplusplus_winrt)
|
|
|
|
#if defined(__cplusplus_winrt)
|
|
|
|
|
|
|
|
return std::string{}; // not supported under uwp
|
|
|
|
return std::string{}; // not supported under uwp
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
size_t len = 0;
|
|
|
|
char *buf = std::getenv(field);
|
|
|
|
char buf[128];
|
|
|
|
|
|
|
|
bool ok = ::getenv_s(&len, buf, sizeof(buf), field) == 0;
|
|
|
|
|
|
|
|
return ok ? buf : std::string{};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#else // revert to getenv
|
|
|
|
|
|
|
|
char *buf = ::getenv(field);
|
|
|
|
|
|
|
|
return buf ? buf : std::string{};
|
|
|
|
return buf ? buf : std::string{};
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
|
|
|
|
#pragma warning(pop)
|
|
|
|
|
|
|
|
#endif // _MSC_VER
|
|
|
|
|
|
|
|
|
|
|
|
// Do fsync by FILE handlerpointer
|
|
|
|
// Do fsync by FILE handlerpointer
|
|
|
|
// Return true on success
|
|
|
|
// Return true on success
|
|
|
|