XDG/Basedir#
An implementation of the FreeDesktop Basedir specification
Info
To use declarations from this page, include the <essence/xdg/basedir.hpp> header.
Note
Implementation detail
For each of the xdg::get calls, the environment is queried first for the
variable corresponding to the directory, such as XDG_CONFIG_HOME or
XDG_DATA_DIRS, before falling back to a sensible default.
-
std::filesystem::path xdg::get::home()#
Get the user’s home directory path.
-
std::filesystem::path xdg::get::config()#
Get the user’s configuration directory.
Default:
$HOME/.config
-
std::filesystem::path xdg::get::cache()#
Get the user’s cache directory.
Default:
$HOME/.cache
-
std::filesystem::path xdg::get::data()#
Get the user’s data directory.
Default:
$HOME/.local/share
-
std::filesystem::path xdg::get::state()#
Get the user’s state directory.
Default:
$HOME/.local/state
-
std::filesystem::path xdg::get::runtime()#
Get the user’s runtime directory.
Default:
/run/user/<user id>
-
std::vector<std::filesystem::path> xdg::get::configs()#
Get the system’s configuration directories.
Default:
/etc/local/xdg, /etc/xdgor the legacy option of/usr/local/etc/xdg, /etc/xdgif it exists and/etc/localdoes not.
-
std::vector<std::filesystem::path> xdg::get::datas()#
Get the system’s data directories.
Default:
/usr/local/share, /usr/share