linux: use $HOME to determine actual user path

As it could be different in confined environments.
This commit is contained in:
Marco Trevisan (Treviño) 2018-02-01 19:30:21 +01:00 committed by John Preston
parent 0de9c62675
commit e88c575d4a
1 changed files with 5 additions and 0 deletions

View File

@ -293,6 +293,11 @@ void psActivateProcess(uint64 pid) {
namespace {
QString getHomeDir() {
auto home = QDir::homePath();
if (home != QDir::rootPath())
return home + '/';
struct passwd *pw = getpwuid(getuid());
return (pw && pw->pw_dir && strlen(pw->pw_dir)) ? (QFile::decodeName(pw->pw_dir) + '/') : QString();
}