All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Radiant::PlatformUtils Namespace Reference

Small utility functions to help handle platform-specific functions. More...

Functions

bool createHardLink (const QString &from, const QString &to)
 Creates a hard link at from, pointing to to. More...
 
QString getExecutablePath ()
 Return absolute path to the executable that was used to launch the process. More...
 
QString getLibraryPath (const QString &libraryName)
 This function returns the path to a library the running process is linked against. More...
 
QString getModuleUserDataPath (const char *module, bool isapplication)
 Return path to the user data directory of the given module. More...
 
int getProcessId ()
 Returns the current process identifier. More...
 
QString getUserDocumentsPath ()
 Return absolute path to the user's "Documents" directory. More...
 
QString getUserHomePath ()
 Return absolute path to the user's home directory. More...
 
int numberOfHardLinks (const QString &file)
 Returns the number of hard links to the file. More...
 
void * openPlugin (const char *path)
 Open a dynamic library. More...
 
uint64_t processMemoryUsage ()
 Returns the memory usage of the process, in bytes This function is not implemented for all platforms. More...
 
void setEnv (const QString &name, const QString &value)
 Sets environment variable. More...
 

Detailed Description

Small utility functions to help handle platform-specific functions.

Function Documentation

bool Radiant::PlatformUtils::createHardLink ( const QString &  from,
const QString &  to 
)

Creates a hard link at from, pointing to to.

Parameters
frompath where the new link will be created
toexisting file, target of the new link
QString Radiant::PlatformUtils::getExecutablePath ( )

Return absolute path to the executable that was used to launch the process.

Returns
Absolute path to the executable used to launch the process
QString Radiant::PlatformUtils::getLibraryPath ( const QString &  libraryName)

This function returns the path to a library the running process is linked against.

Parameters
libraryName(part of) linked library name to search for
Returns
absolute path to the library file
QString Radiant::PlatformUtils::getModuleUserDataPath ( const char *  module,
bool  isapplication 
)

Return path to the user data directory of the given module.

Parameters
moduleName of the module whose data directory is being queried
isapplicationTrue if the modul is application, false otherwise.
Returns
Absolute path of the given module inside user's home directory
int Radiant::PlatformUtils::getProcessId ( )

Returns the current process identifier.

Returns
Process id of this process
QString Radiant::PlatformUtils::getUserDocumentsPath ( )

Return absolute path to the user's "Documents" directory.

Returns
Absolute path to user's Documents directory
QString Radiant::PlatformUtils::getUserHomePath ( )

Return absolute path to the user's home directory.

Returns
Absolute path to user's home directory
int Radiant::PlatformUtils::numberOfHardLinks ( const QString &  file)

Returns the number of hard links to the file.

Parameters
filefile path
Returns
the number of hard links or -1 on error
void* Radiant::PlatformUtils::openPlugin ( const char *  path)

Open a dynamic library.

Parameters
pathFull path to plugin
Returns
Handle to plugin or nullptr if failed
uint64_t Radiant::PlatformUtils::processMemoryUsage ( )

Returns the memory usage of the process, in bytes This function is not implemented for all platforms.

Returns
Size of memory usage (in bytes)
void Radiant::PlatformUtils::setEnv ( const QString &  name,
const QString &  value 
)

Sets environment variable.

Parameters
namename of the environment variable
valuevalue of the environment variable