Prefer HOME env var before trying getpwuid
This commit is contained in:
parent
036c8a7c26
commit
0df3db43c6
1 changed files with 3 additions and 3 deletions
|
|
@ -121,10 +121,10 @@ static std::string homeDir()
|
||||||
return system::join(homedrive, homepath);
|
return system::join(homedrive, homepath);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (struct passwd* const pwd = getpwuid(getuid()))
|
if (const char* const home = getenv("HOME"))
|
||||||
return pwd->pw_dir;
|
|
||||||
else if (const char* const home = getenv("HOME"))
|
|
||||||
return home;
|
return home;
|
||||||
|
else if (struct passwd* const pwd = getpwuid(getuid()))
|
||||||
|
return pwd->pw_dir;
|
||||||
#endif
|
#endif
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue