MCPcopy Create free account
hub / github.com/arrayfire/forge / getEnvVar

Function getEnvVar

src/backend/common/util.cpp:25–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23using std::string;
24
25string getEnvVar(const std::string &key)
26{
27#if defined(OS_WIN)
28 DWORD bufSize = 32767; // limit according to GetEnvironment Variable documentation
29 string retVal;
30 retVal.resize(bufSize);
31 bufSize = GetEnvironmentVariable(key.c_str(), &retVal[0], bufSize);
32 if (!bufSize) {
33 return string("");
34 } else {
35 retVal.resize(bufSize);
36 return retVal;
37 }
38#else
39 char * str = getenv(key.c_str());
40 return str==NULL ? string("") : string(str);
41#endif
42}
43
44}
45}

Callers 1

print_errorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected