mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-21 01:24:21 +00:00
Added methods to SystemStats to return the user's name.
This commit is contained in:
parent
0d024b3306
commit
ca0dce68d5
8 changed files with 131 additions and 24 deletions
|
|
@ -214,6 +214,25 @@ int SystemStats::getNumCpus() throw()
|
|||
return lastCpu + 1;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
const String SystemStats::getLogonName()
|
||||
{
|
||||
const char* user = getenv ("USER");
|
||||
|
||||
if (user == 0)
|
||||
{
|
||||
struct passwd* const pw = getpwuid (getuid());
|
||||
if (pw != 0)
|
||||
user = pw->pw_name;
|
||||
}
|
||||
|
||||
return String::fromUTF8 ((const uint8*) user);
|
||||
}
|
||||
|
||||
const String SystemStats::getFullUserName()
|
||||
{
|
||||
return getLogonName();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void SystemStats::initialiseStats() throw()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue