Home2L - C/C++ API v1.4-0-g38cc (2024-05-25)
Smart Tools for a Private Home
|
Direct access to basic environment properties and helpers.
Environment ... | |
const char * | EnvBuildOS () |
Operating software ("Debian", "Android", ...). | |
const char * | EnvBuildArch () |
Operating architecture (e.g. "i386", "armhf", ...). | |
const char * | EnvMachineName () |
Machine name (network host name). | |
const char * | EnvExecPathName () |
Full path name of the executable (== argv[0]). More... | |
const char * | EnvExecName () |
File name of the executable without path. | |
const char * | EnvInstanceName () |
Instance name - the identifier for the running process. More... | |
const char * | EnvDroidId () |
Droid ID. | |
int | EnvPid () |
Operating system's process identifier (PID). | |
bool | EnvHaveTerminal () |
'true', if the application has been started from an interactive terminal. | |
void | EnvReadIniFile (const char *fileName, CDictCompact< CString > *map) |
Read a .ini file. 'fileName' must be an absolute path name. | |
Directories ... | |
const char * | EnvHome2lRoot () |
Root installation path: all static data (blob + etc). | |
const char * | EnvHome2lEtc () |
'etc' root path: configuration data. | |
const char * | EnvHome2lVar () |
'var' root path: dynamic data (saved over reboots). | |
const char * | EnvHome2lTmp () |
'tmp' root path: dynamic data (not need to save over reboots). | |
const char * | EnvGetHome2lRootPath (CString *ret, const char *relOrAbsPath) |
Return an absolute path name in the root domain. A path starting with '/' is considered already absolute and is returned unchanged, but normalized. | |
const char * | EnvGetHome2lEtcPath (CString *ret, const char *relOrAbsPath) |
Return an absolute path name in the 'etc' domain. | |
const char * | EnvGetHome2lVarPath (CString *ret, const char *relOrAbsPath) |
Return an absolute path name in the 'var' domain. | |
const char * | EnvGetHome2lTmpPath (CString *ret, const char *relOrAbsPath) |
Return an absolute path name in the 'tmp' domain. | |
bool | EnvMkVarDir (const char *relOrAbsPath) |
Prepare (create) a directory in the 'var' domain. More... | |
bool | EnvMkTmpDir (const char *relOrAbsPath) |
Prepare (create) a directory in the 'tmp' domain. | |
Network ... | |
bool | EnvNetResolve (const char *hostAndPort, CString *retHost, int *retPort=NULL, int defaultPort=0, bool warn=true) |
Get a resolved host + port combination. More... | |
const char * EnvExecPathName | ( | ) |
Full path name of the executable (== argv[0]).
Note: The return values of EnvExecPathName() and EnvExecName() may be undefined (== NULL), e.g. if the main program is a Python script or an Android app.
const char * EnvInstanceName | ( | ) |
Instance name - the identifier for the running process.
The instance name weakly identifies the running process as follows:
bool EnvMkVarDir | ( | const char * | relOrAbsPath | ) |
Prepare (create) a directory in the 'var' domain.
relOrAbsPath | is either an absolute path or a path relative to the domain. |
On error, a warning is emitted and 'false' is returned.
bool EnvNetResolve | ( | const char * | hostAndPort, |
CString * | retHost, | ||
int * | retPort = NULL , |
||
int | defaultPort = 0 , |
||
bool | warn = true |
||
) |
Get a resolved host + port combination.
hostAndPort | is a given network host name, optionally followed by ':' and a port number. The host part is translated using the 'net.resolve.<name>' settings. |
retHost | is set to the resolved networt host name or IP address. |
retPort | may contain a pointer to the resolved port number. This is the first of the following numbers: a) port appended to hostAndPort , b) port given in the 'net.resolve.<name>' setting, c) port passed as defaultPort . |
defaultPort | is the default port. |
warn | decides whether a warning is logged on error. |