From 1aaf65abfecbde8548f90b1d0b0308b21bd0776d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 12 Aug 2019 03:59:52 -0700 Subject: Add methods to get env vars as an optional --- common/strutils.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'common/strutils.h') diff --git a/common/strutils.h b/common/strutils.h index 2bfd15fc..db9b07c6 100644 --- a/common/strutils.h +++ b/common/strutils.h @@ -1,12 +1,14 @@ #ifndef AL_STRUTILS_H #define AL_STRUTILS_H -#ifdef _WIN32 +#include + +#include "aloptional.h" +#ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include -#include inline std::string wstr_to_utf8(const WCHAR *wstr) { @@ -40,4 +42,13 @@ inline std::wstring utf8_to_wstr(const char *str) #endif +namespace al { + +al::optional getenv(const char *envname); +#ifdef _WIN32 +al::optional getenv(const WCHAR *envname); +#endif + +} // namespace al + #endif /* AL_STRUTILS_H */ -- cgit v1.2.3