Skip to content

Commit 0f5ebd7

Browse files
author
Mate Barany
committed
QFileSystemEngine/Win: use qEnvironmentVariable instead of qgetenv
It returns a QString immediately so there is no need for additional conversions. On Windows, it is also lossless. Pick-to: 6.10 Change-Id: I672d362116551a578c9eb111dd56785893de22be Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
1 parent cc31f7b commit 0f5ebd7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/corelib/io/qfilesystemengine_win.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ bool QFileSystemEngine::rmpath(const QFileSystemEntry &entry)
16001600
//static
16011601
QString QFileSystemEngine::rootPath()
16021602
{
1603-
QString ret = QString::fromLatin1(qgetenv("SystemDrive"));
1603+
QString ret = qEnvironmentVariable("SystemDrive");
16041604
if (ret.isEmpty())
16051605
ret = "c:"_L1;
16061606
ret.append(u'/');
@@ -1634,12 +1634,12 @@ QString QFileSystemEngine::homePath()
16341634
}
16351635
#endif
16361636
if (ret.isEmpty() || !QFile::exists(ret)) {
1637-
ret = QString::fromLocal8Bit(qgetenv("USERPROFILE"));
1637+
ret = qEnvironmentVariable("USERPROFILE");
16381638
if (ret.isEmpty() || !QFile::exists(ret)) {
1639-
ret = QString::fromLocal8Bit(qgetenv("HOMEDRIVE"))
1640-
+ QString::fromLocal8Bit(qgetenv("HOMEPATH"));
1639+
ret = qEnvironmentVariable("HOMEDRIVE")
1640+
+ qEnvironmentVariable("HOMEPATH");
16411641
if (ret.isEmpty() || !QFile::exists(ret)) {
1642-
ret = QString::fromLocal8Bit(qgetenv("HOME"));
1642+
ret = qEnvironmentVariable("HOME");
16431643
if (ret.isEmpty() || !QFile::exists(ret))
16441644
ret = rootPath();
16451645
}

0 commit comments

Comments
 (0)