diff options
author | Fabien Proriol <fabien.proriol@kazoe.org> | 2025-05-25 12:13:31 +0200 |
---|---|---|
committer | Fabien Proriol <fabien.proriol@kazoe.org> | 2025-05-25 12:13:31 +0200 |
commit | 1dbc0e3c88ba271ba35bc3f82e7864c4f35e1236 (patch) | |
tree | 8c491cd196e2eff4c59f8c23f566f7ff26981586 /src/lib/xdgbasedir.h |
Initial Commit
Diffstat (limited to 'src/lib/xdgbasedir.h')
-rw-r--r-- | src/lib/xdgbasedir.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/src/lib/xdgbasedir.h b/src/lib/xdgbasedir.h new file mode 100644 index 0000000..bd7d688 --- /dev/null +++ b/src/lib/xdgbasedir.h @@ -0,0 +1,97 @@ +/*! \file xdgbasedir.h + \brief Implementation of basedir-spec + \author Fabien Proriol + + Implementation of https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.6.html +*/ + +#ifndef XDGBASEDIR_H +#define XDGBASEDIR_H + +#include <QString> + +//! XDG basedir implementation +namespace xdg { +/*! + * \addtogroup XDG + * @{ + */ + +/*! \fn QString dataHome() + \brief Return XDG_DATA_HOME + XDG_DATA_HOME defines the base directory relative to + which user-specific data files should be stored. + \return $XDG_DATA_HOME content or $HOME/.local/share if not set +*/ + QString dataHome(); + + +/*! \fn QString configHome() + \brief Return XDG_CONFIG_HOME + XDG_CONFIG_HOME defines the base directory relative to + which user-specific configuration files should be stored. + \return $XDG_CONFIG_HOME content or $HOME/.config if not set +*/ + QString configHome(); + + +/*! \fn QString stateHome() + \brief Return XDG_STATE_HOME + XDG_STATE_HOME defines the base directory relative to + which user-specific state files should be stored. + \return $XDG_STATE_HOME content or $HOME/.local/state if not set +*/ + QString stateHome(); + + +/*! \fn QStringList dataDirs() + \brief Return XDG_DATA_DIRS + XDG_DATA_DIRS defines the preference-ordered set of + base directories to search for data files in addition + to the $XDG_DATA_HOME base directory. + The directories in $XDG_DATA_DIRS should be seperated + with a colon ':'. + \return $XDG_DATA_DIRS content or /usr/local/share:/usr/share if not set +*/ + QStringList dataDirs(); + +/*! \fn QStringList dataDirs() + \brief Return XDG_CONFIG_DIRS + XDG_CONFIG_DIRS defines the preference-ordered set of + base directories to search for configuration files in addition + to the $XDG_CONFIG_HOME base directory. + The directories in $XDG_CONFIG_DIRS should be seperated + with a colon ':'. + \return $XDG_CONFIG_DIRS content or /etc/xdg if not set +*/ + QStringList configDirs(); + + +/*! \fn QString cacheHome() + \brief Return XDG_CONFIG_DIRS + XDG_CACHE_HOME defines the base directory relative to + which user-specific non-essential data files should be + stored. + If $XDG_CACHE_HOME is either not set or empty, a default + equal to $HOME/.cache should be used. + \return $XDG_CONFIG_DIRS content or $HOME/.cache if not set +*/ + QString cacheHome(); + + +/*! \fn QString runtimeDir() + \brief Return XDG_CONFIG_DIRS + XDG_RUNTIME_DIR defines the base directory relative to + which user-specific non-essential runtime files and other + file objects (such as sockets, named pipes, ...) should + be stored. The directory MUST be owned by the user, + and he MUST be the only one having read and write access + to it. Its Unix access mode MUST be 0700. + \return $XDG_RUNTIME_DIR content or emit a warning and return /run/user/$USER +*/ + QString runtimeDir(); + +/*! @} End of XDG*/ +} + +#endif // XDGBASEDIR_H |