MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / GetHomeDirectory

Function GetHomeDirectory

Source/Common/Config.cpp:508–527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

506}
507
508const char* GetHomeDirectory() {
509 const char* HomeDir = getenv("HOME");
510
511 // Try to get home directory from uid
512 if (!HomeDir || !FHU::Filesystem::Exists(HomeDir)) {
513 HomeDir = FindUserHomeThroughUID();
514 }
515
516 // try the PWD
517 if (!HomeDir || !FHU::Filesystem::Exists(HomeDir)) {
518 HomeDir = getenv("PWD");
519 }
520
521 // Still doesn't exit? You get local
522 if (!HomeDir || !FHU::Filesystem::Exists(HomeDir)) {
523 HomeDir = ".";
524 }
525
526 return HomeDir;
527}
528#else
529const char* GetHomeDirectory() {
530 const char* HomeDir = getenv("WINEHOMEDIR");

Callers 3

GetDataDirectoryFunction · 0.85
GetConfigDirectoryFunction · 0.85
LoadThunkDatabaseMethod · 0.85

Calls 3

getenvFunction · 0.85
FindUserHomeThroughUIDFunction · 0.85
ExistsFunction · 0.50

Tested by

no test coverage detected