Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
local_server_name.h
Go to the documentation of this file.
1#ifndef COCKATRICE_LOCAL_SERVER_NAME_H
2#define COCKATRICE_LOCAL_SERVER_NAME_H
3
4#include <QDir>
5#include <QString>
6#include <QtGlobal>
7
16inline QString scopedLocalServerName(const QString &prefix)
17{
18 QString userName = qEnvironmentVariable("USER");
19 if (userName.isEmpty()) {
20 userName = qEnvironmentVariable("USERNAME");
21 }
22 if (userName.isEmpty()) {
23 userName = QDir::home().dirName();
24 }
25 return prefix + QLatin1Char('-') + userName;
26}
27
28#endif // COCKATRICE_LOCAL_SERVER_NAME_H
QString scopedLocalServerName(const QString &prefix)
Builds a QLocalServer/QLocalSocket name scoped to the current user.
Definition local_server_name.h:16