10 #define WIN32_LEAN_AND_MEAN
13 std::string
wstr_to_utf8(const WCHAR
*wstr
)
17 int len
= WideCharToMultiByte(CP_UTF8
, 0, wstr
, -1, nullptr, 0, nullptr, nullptr);
21 WideCharToMultiByte(CP_UTF8
, 0, wstr
, -1, &ret
[0], len
, nullptr, nullptr);
28 std::wstring
utf8_to_wstr(const char *str
)
32 int len
= MultiByteToWideChar(CP_UTF8
, 0, str
, -1, nullptr, 0);
36 MultiByteToWideChar(CP_UTF8
, 0, str
, -1, &ret
[0], len
);
46 al::optional
<std::string
> getenv(const char *envname
)
48 const char *str
{std::getenv(envname
)};
49 if(str
&& str
[0] != '\0') return str
;
54 al::optional
<std::wstring
> getenv(const WCHAR
*envname
)
56 const WCHAR
*str
{_wgetenv(envname
)};
57 if(str
&& str
[0] != L
'\0') return str
;