MCPcopy Create free account
hub / github.com/crownengine/crown / getEnv

Function getEnv

3rdparty/bx/src/os.cpp:215–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213 }
214
215 bool getEnv(char* _out, uint32_t* _inOutSize, const StringView& _name)
216 {
217 const int32_t nameMax = _name.getLength()+1;
218 char* name = (char*)BX_STACK_ALLOC(nameMax);
219 strCopy(name, nameMax, _name);
220
221#if BX_PLATFORM_WINDOWS
222 DWORD len = ::GetEnvironmentVariableA(name, _out, *_inOutSize);
223 bool result = len != 0 && len < *_inOutSize;
224 *_inOutSize = len;
225 return result;
226#elif BX_PLATFORM_EMSCRIPTEN \
227 || BX_PLATFORM_PS4 \
228 || BX_PLATFORM_XBOXONE \
229 || BX_PLATFORM_WINRT \
230 || BX_PLATFORM_NX \
231 || BX_CRT_NONE
232 BX_UNUSED(name, _out, _inOutSize);
233 return false;
234#else
235 const char* ptr = ::getenv(name);
236 uint32_t len = 0;
237 bool result = false;
238 if (NULL != ptr)
239 {
240 len = (uint32_t)strLen(ptr);
241
242 result = len != 0 && len < *_inOutSize;
243 if (len < *_inOutSize)
244 {
245 strCopy(_out, *_inOutSize, ptr);
246 }
247 }
248
249 *_inOutSize = len;
250 return result;
251#endif // BX_PLATFORM_
252 }
253
254 void setEnv(const StringView& _name, const StringView& _value)
255 {

Callers 2

getenvFunction · 0.70
DbgHelpSymbolResolveMethod · 0.70

Calls 3

strCopyFunction · 0.85
strLenFunction · 0.85
getenvFunction · 0.70

Tested by

no test coverage detected