summaryrefslogtreecommitdiff
path: root/src/lib/xdgbasedir.h
blob: bd7d688d47d23d4e2c63a0a30448da1a62549480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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