From 7e08917f21c41febfc1ce22f9c01587f2529284b Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Thu, 30 Jul 2020 21:17:17 -0400 Subject: [PATCH] cache environment queries in QFileSystemEngine::homePath() and QFileSystemEngine::tempPath() Signed-off-by: Ivailo Monev --- src/core/io/qfilesystemengine_unix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/io/qfilesystemengine_unix.cpp b/src/core/io/qfilesystemengine_unix.cpp index c9ece5657..9a0929208 100644 --- a/src/core/io/qfilesystemengine_unix.cpp +++ b/src/core/io/qfilesystemengine_unix.cpp @@ -460,7 +460,7 @@ bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Per QString QFileSystemEngine::homePath() { - const QString home = QFile::decodeName(qgetenv("HOME")); + static const QString home = QFile::decodeName(qgetenv("HOME")); if (Q_LIKELY(!home.isEmpty())) return QDir::cleanPath(home); return rootPath(); @@ -473,7 +473,7 @@ QString QFileSystemEngine::rootPath() QString QFileSystemEngine::tempPath() { - const QString temp = QFile::decodeName(qgetenv("TMPDIR")); + static const QString temp = QFile::decodeName(qgetenv("TMPDIR")); if (!temp.isEmpty()) return QDir::cleanPath(temp); return QLatin1String("/tmp"); -- 2.11.0