diff --git a/src/corelib/io/qstandardpaths_json.cpp b/src/corelib/io/qstandardpaths_json.cpp index c7cb858f0f..8542371848 100644 --- a/src/corelib/io/qstandardpaths_json.cpp +++ b/src/corelib/io/qstandardpaths_json.cpp @@ -193,7 +193,7 @@ QString QStandardPaths::writableLocation(StandardLocation type) QString value = iter.value().toString(); // optimize for a common case - value.replace(QLatin1String("${HOME}"), QFile::decodeName(qgetenv("HOME"))); + value.replace(QLatin1String("${HOME}"), QDir::homePath()); // Do ${} format environment variable substitution if necessary if (!value.isEmpty() && value.contains(QLatin1String("${"))) { diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index 75c9664d1d..f7689c1620 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -825,7 +825,7 @@ void QUnixPrintWidgetPrivate::applyPrinterProperties(QPrinter *p) return; printer = p; if (p->outputFileName().isEmpty()) { - QString home = QString::fromLocal8Bit(qgetenv("HOME").constData()); + QString home = QDir::homePath(); QString cur = QDir::currentPath(); if (home.at(home.length()-1) != QLatin1Char('/')) home += QLatin1Char('/');