MCPcopy Create free account
hub / github.com/OpenMW/openmw / getUserHome

Function getUserHome

components/files/linuxpath.cpp:16–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14namespace
15{
16 std::filesystem::path getUserHome()
17 {
18 const char* dir = getenv("HOME");
19 if (dir == nullptr)
20 {
21 struct passwd* pwd = getpwuid(getuid());
22 if (pwd != nullptr)
23 {
24 dir = pwd->pw_dir;
25 }
26 }
27 if (dir == nullptr)
28 return {};
29 else
30 return dir;
31 }
32
33 std::filesystem::path getEnv(const std::string& envVariable, const std::filesystem::path& fallback)
34 {

Callers 4

getUserConfigPathMethod · 0.70
getUserDataPathMethod · 0.70
getCachePathMethod · 0.70
getInstallPathsMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected