Browse Source
uh
Signed-off-by: crueter <crueter@eden-emu.dev>
pull/3021/head
crueter
3 months ago
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
1 changed files with
9 additions and
9 deletions
-
src/common/logging/backend.cpp
|
|
@ -113,15 +113,15 @@ public: |
|
|
// instance of logging an entry...
|
|
|
// instance of logging an entry...
|
|
|
static std::string username = []() -> std::string { |
|
|
static std::string username = []() -> std::string { |
|
|
// in order of precedence
|
|
|
// in order of precedence
|
|
|
static constexpr const std::array<const char*, 3> environment_variables = { |
|
|
|
|
|
|
|
|
// LOGNAME usually works on UNIX, USERNAME on Windows
|
|
|
|
|
|
// Some UNIX systems suck and don't use LOGNAME so we also
|
|
|
|
|
|
// need USER :(
|
|
|
|
|
|
for (auto const var : { |
|
|
"LOGNAME", |
|
|
"LOGNAME", |
|
|
"USERNAME", |
|
|
"USERNAME", |
|
|
"USER", |
|
|
"USER", |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
for (const char* var : environment_variables) { |
|
|
|
|
|
const char* s = getenv(var); |
|
|
|
|
|
if (s != nullptr) |
|
|
|
|
|
|
|
|
}) { |
|
|
|
|
|
if (auto const s = getenv(var); s != nullptr) |
|
|
return std::string{s}; |
|
|
return std::string{s}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|