|
Application & environment utility
|
|
A number of utility functions to obtain information about your application and system environment.
String GetExeFilePath()
Returns the absolute path towards the application's binary.
String GetEnv(const char *id)
Returns the value of the environment variable id.
String GetExeDirFile(const char *fp)
Returns the absolute path of a file that is found in the folder where you application's binary resides.
fp..................................................the name of the file
String GetHomeDirectory()
Returns the absolute path of current user's home folder.
String GetHomeDirFile(const char *fp)
Returns the absolute path of a file that is found in the current user's home folder.
fp..................................................the name of the file
String GetExeTitle()
Returns the title of the application.
void UseHomeDirectoryConfig(bool b = true)
Sets the search path for configuration to either the current users' home folder or to the folder where the application's binary resides.
b...................................................use home folder (true) or application folder (false)
String ConfigFile(const char *file)
Returns the absolute path of a configuration file found in the configuration files search path.
file...............................................the name of the file
String ConfigFile()
Returns the default configuration file from the configuration files search path. The default configuration file is called [application title].cfg.
const Vector<String>& CommandLine()
Return a vector of strings containing the command line parameters.
const VectorMap<String, String>& Environment()
Returns a vector of strings with system environment variables.
void SetExitCode(int code)
Sets the exit code that will be returned on application exit.
code.............................................the exit code
int GetExitCode()
Gets the exit code that will be returned on application exit.
bool IsMainRunning()
Return true if the applications execution has reached and not yet exited the main function.
String GetDataFile(const char *filename)
This function is designed to retrieve the path of file that contains application specific data. Behaviour depends on whether application was started from 'theide' - in that case theide passes a reference to main package directory through environment variable "UPP_MAIN__" and the resulting file is in this directory. When started standalone, the function is equivalent to GetExeDirFile.
String GetComputerName()
Returns the name of computer.
String GetUserName()
Returns current user.
String GetDesktopManager()
Returns current GUI identifier. Predefined values are "windows", "gnome", "kde". If X11 desktop manager is not in this list, the value of "DESKTOP_SESSION" environment variable is returned.
void LaunchWebBrowser(const String& url)
Opens an URL in the default Web Browser.
url................................................the URL that will be opened in the browser
void SetHomeDirectory(const char *dir)
POSIX specific
Sets the current user's home folder.
dir................................................the URL that will be opened in the browser
bool CpuMMX()
Returns true if CPU has MMX support.
template <class T> T minmax(T x, T _min, T _max)
Returns x if it is between _min and _max.
If x is lower than _min it returns _min.
If x is higher than _max it returns _max.
bool CpuSSE()
Returns true if CPU has SSE support.
bool CpuSSE2()
Returns true if CPU has SSE2 support.
bool CpuSSE3()
Returns true if CPU has SSE3 support.
int CPU_Cores()
Returns the number of cores the CPU has.
|