Fix env variable on Windows

This commit is contained in:
Albert Vaca 2018-11-20 21:49:46 +01:00
parent 929fd062f2
commit b9932769c9

View file

@ -147,7 +147,13 @@ KdeConnectConfig::KdeConnectConfig()
QString KdeConnectConfig::name()
{
QString defaultName = qgetenv("USER") + '@' + QHostInfo::localHostName();
QString username;
#ifdef Q_OS_WIN
username = qgetenv("USERNAME");
#else
username = qgetenv("USER");
#endif
QString defaultName = username + '@' + QHostInfo::localHostName();
QString name = d->m_config->value(QStringLiteral("name"), defaultName).toString();
return name;
}