Gorgon Game Engine
Gorgon::OS::User Namespace Reference

Contains user related information and services. More...

Functions

std::string GetDataPath ()
 Returns the path where applications can save data related to this user. More...
 
std::string GetDocumentsPath ()
 Returns the path where documents of the user should be saved. More...
 
std::string GetHomePath ()
 Returns the home directory of the user. More...
 
std::string GetName ()
 Returns the name of the current user. More...
 
std::string GetUsername ()
 Returns the current username. More...
 
bool IsAdmin ()
 Check if the currently logged in user is an administrator. More...
 

Detailed Description

Contains user related information and services.

Function Documentation

◆ GetDataPath()

std::string GetDataPath ( )

Returns the path where applications can save data related to this user.

This path could simply be user's home directory. Best practice would be creating a directory that starts with a "." such as .gorgon

References Gorgon::OS::GetEnvVar().

◆ GetDocumentsPath()

std::string GetDocumentsPath ( )

Returns the path where documents of the user should be saved.

References Gorgon::OS::GetEnvVar(), and Gorgon::Filesystem::IsDirectory().

◆ GetHomePath()

std::string GetHomePath ( )

Returns the home directory of the user.

References Gorgon::OS::GetEnvVar().

◆ GetName()

std::string GetName ( )

Returns the name of the current user.

◆ GetUsername()

std::string GetUsername ( )

Returns the current username.

◆ IsAdmin()

bool IsAdmin ( )

Check if the currently logged in user is an administrator.

If you are looking to perform an elevated operation, you best try to perform the operation without checking if the user is an admin first. It might be possible for a regular user to have extra permissions. Check this function afterwards before asking for elevation.