9 #define WIN32_LEAN_AND_MEAN
14 std::string
wstr_to_utf8(std::wstring_view wstr
)
18 const int len
{WideCharToMultiByte(CP_UTF8
, 0, wstr
.data(), al::sizei(wstr
), nullptr, 0,
22 ret
.resize(static_cast<size_t>(len
));
23 WideCharToMultiByte(CP_UTF8
, 0, wstr
.data(), al::sizei(wstr
), ret
.data(), len
,
30 std::wstring
utf8_to_wstr(std::string_view str
)
34 const int len
{MultiByteToWideChar(CP_UTF8
, 0, str
.data(), al::sizei(str
), nullptr, 0)};
37 ret
.resize(static_cast<size_t>(len
));
38 MultiByteToWideChar(CP_UTF8
, 0, str
.data(), al::sizei(str
), ret
.data(), len
);
47 std::optional
<std::string
> getenv(const char *envname
)
50 const char *str
{::getenv(envname
)};
52 const char *str
{std::getenv(envname
)};
54 if(str
&& *str
!= '\0')
60 std::optional
<std::wstring
> getenv(const WCHAR
*envname
)
62 const WCHAR
*str
{_wgetenv(envname
)};
63 if(str
&& *str
!= L
'\0')