Implementation of XDG Base Directory Specification (version 0.7). More...
Macros | |
| #define | MAIN_ERR_PREFIX "XDG: " |
| Message prefix for XDG module. | |
Functions | |
| int | xdg_append_to_path (const char **buf, const char *newcomp) |
| Append path component to buffer. More... | |
| const char * | xdg_get_confdir (const char *progname) |
| Get configuration directory. More... | |
Implementation of XDG Base Directory Specification (version 0.7).
| int xdg_append_to_path | ( | const char ** | buf, |
| const char * | newcomp | ||
| ) |
Append path component to buffer.
| [in] | buf | Pointer to buffer pointer |
| [in] | newcomp | New path component to append |
First a slash "/" is appended to the content of buf. Then, if newcomp is not NULL , it is appended after the slash. Additional memory is automatically allocated.
realloc() .Definition at line 55 of file xdg.c.
References PRINT_ERROR.
Referenced by core_get_cancel_key(), log_get_logpathname(), and xdg_get_confdir().
| const char* xdg_get_confdir | ( | const char * | progname | ) |
Get configuration directory.
| [in] | progname | Program name |
If progname is NULL then $XDG_CONFIG_HOME is returned. Otherwise progname is appended as subdirectory and $XDG_CONFIG_HOME/progname is returned.
If XDG_CONFIG_HOME is not defined, the default $HOME/.config is used (it is treated as error if HOME is not defined in this case).
NULL on error Definition at line 115 of file xdg.c.
References fu_check_path(), fu_create_path(), main_confprefix, main_debug, MAIN_ERR_PREFIX, PRINT_ERROR, ts_getenv(), and xdg_append_to_path().
Referenced by core_get_cancel_key(), and log_get_logpathname().