1
0
Fork 0
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:
Julian Storer 2010-02-05 18:36:19 +00:00
parent 0d024b3306
commit ca0dce68d5
8 changed files with 131 additions and 24 deletions

View file

@ -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()