1 /**
2  * @file unixinfo.h
3  * Unix system-level configuration.
4  *
5  * @authors Copyright © 2012-2017 Jaakko Keränen <jaakko.keranen@iki.fi>
6  * @authors Copyright © 2013 Daniel Swanson <danij@dengine.net>
7  *
8  * @par License
9  * LGPL: http://www.gnu.org/licenses/lgpl.html
10  *
11  * <small>This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License as published by
13  * the Free Software Foundation; either version 3 of the License, or (at your
14  * option) any later version. This program is distributed in the hope that it
15  * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
16  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
17  * General Public License for more details. You should have received a copy of
18  * the GNU Lesser General Public License along with this program; if not, see:
19  * http://www.gnu.org/licenses</small>
20  */
21 
22 #ifndef LIBDENG2_UNIXINFO_H
23 #define LIBDENG2_UNIXINFO_H
24 
25 #include "../String"
26 #include "../NativePath"
27 
28 namespace de {
29 
30 /**
31  * System-level configuration preferences for the Unix platform. These are used
32  * for setting specific directory locations, e.g., where shared libraries are
33  * expected to be found. The configuration has two levels: system-global
34  * configuration under <tt>/etc</tt> and user-specific configuration under
35  * <tt>~/.doomsday</tt>.
36  *
37  * UnixInfo exists because hand-edited config files are commonly found on Unix
38  * but not on the other platforms. On non-Unix platforms, UnixInfo is
39  * instantiated normally but no input files are parsed. There are equivalent
40  * mechanisms on these platforms (on Windows, the closest is the registry; on
41  * macOS, ~/Library/Preferences/) but these are not directly used by
42  * Doomsday. Instead of these, one should use Config (or QSettings) for
43  * platform-independent persistent configuration.
44  *
45  * @ingroup core
46  */
47 class UnixInfo
48 {
49 public:
50     /**
51      * Loads the system-level Info files.
52      */
53     UnixInfo();
54 
55     /**
56      * Returns a path preference. Any symbols in the path (e.g., ~) are expanded
57      * before the value is returned.
58      *
59      * @param key    Path identifier.
60      * @param value  The value is returned here.
61      *
62      * @return  @c true, if the path was defined; otherwise @c false.
63      */
64     bool path(String const &key, NativePath &value) const;
65 
66     /**
67      * Returns a defaults preference.
68      *
69      * @param key    Path identifier.
70      * @param value  The value is returned here.
71      *
72      * @return @c true, iff the value is defined in the 'defaults' info file.
73      */
74     bool defaults(String const &key, String &value) const;
75 
76 private:
77     DENG2_PRIVATE(d)
78 };
79 
80 } // namespace de
81 
82 #endif // LIBDENG2_UNIXINFO_H
83