problem with QDir::homePath()
[GNU/Linux, Qt 4.8]
I have
HOME=/home/wl
in my environment, but
QDir::homePath()
returns “/” instead of “/home/wl”.
How comes? For debugging, I’ve also used getenv() at the very same place in the code, and it correctly returns “/home/wl”.
Werner7 replies
The homePath is extracted from the HOME environment variable. If that is empty, the filesystem root is used:
qfilesystemengine_unix.cpp:
- {
- if (home.isNull())
- home = rootPath();
- }
So it seems your HOME env variable got lost during application startup. You should check that with
- qDebug() << qgetenv("HOME");
You must log in to post a reply. Not a member yet? Register here!



