diff options
-rw-r--r-- | src/corelib/io/qfilesystemengine_unix.cpp | 2 | ||||
-rw-r--r-- | tests/auto/corelib/io/qdir/tst_qdir.cpp | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 2fc7557509..4af01f6730 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -633,7 +633,7 @@ bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Per QString QFileSystemEngine::homePath() { QString home = QFile::decodeName(qgetenv("HOME")); - if (home.isNull()) + if (home.isEmpty()) home = rootPath(); return QDir::cleanPath(home); } diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 7799d40de7..d44ef167b5 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -1344,6 +1344,14 @@ void tst_QDir::homePath() #ifdef Q_OS_UNIX if (strHome.length() > 1) // root dir = "/" QVERIFY(!strHome.endsWith('/')); + + QByteArray envHome = qgetenv("HOME"); +#if !defined(_WRS_KERNEL) // unsetenv is not available on VxWorks DKM mode + unsetenv("HOME"); +#endif + QCOMPARE(QDir::homePath(), QDir::rootPath()); + qputenv("HOME", envHome); + #elif defined(Q_OS_WIN) if (strHome.length() > 3) // root dir = "c:/"; "//" is not really valid... QVERIFY(!strHome.endsWith('/')); |