MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetEnv

Function GetEnv

src/string.cpp:854–859  ·  view source on GitHub ↗

* Get the environment variable using std::getenv and when it is an empty string (or nullptr), return \c std::nullopt instead. * @param variable The environment variable to read from. * @return The environment value, or \c std::nullopt. */

Source from the content-addressed store, hash-verified

852 * @return The environment value, or \c std::nullopt.
853 */
854std::optional<std::string_view> GetEnv(const char *variable)
855{
856 auto val = std::getenv(variable);
857 if (val == nullptr || *val == '\0') return std::nullopt;
858 return val;
859}

Callers 9

GetCurrentLocaleFunction · 0.85
GetHomeDirFunction · 0.85
DetermineBasePathsFunction · 0.85
DeterminePathsFunction · 0.85
NetworkSurveyUriStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected