diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-01-17 02:51:10 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-01-17 02:51:10 +0100 |
commit | 8fa757a9418eed2685595227c86c3c34c389adcf (patch) | |
tree | dcc86e8381c3558b95572e3aef065aac4b4a70b8 /src/util/configuration.c | |
parent | 3c1f2bdd852ce7961556b5c7571bf64cd0da98bb (diff) | |
download | gnunet-8fa757a9418eed2685595227c86c3c34c389adcf.tar.gz gnunet-8fa757a9418eed2685595227c86c3c34c389adcf.zip |
auto-provide OS_IPK paths in [paths] of config
Diffstat (limited to 'src/util/configuration.c')
-rw-r--r-- | src/util/configuration.c | 85 |
1 files changed, 81 insertions, 4 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c index cb6932b15..0480ebd5d 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2006, 2007, 2008, 2009, 2013 GNUnet e.V. | 3 | Copyright (C) 2006, 2007, 2008, 2009, 2013, 2020 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -17,16 +17,15 @@ | |||
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | |||
21 | /** | 20 | /** |
22 | * @file src/util/configuration.c | 21 | * @file src/util/configuration.c |
23 | * @brief configuration management | 22 | * @brief configuration management |
24 | * @author Christian Grothoff | 23 | * @author Christian Grothoff |
25 | */ | 24 | */ |
26 | |||
27 | #include "platform.h" | 25 | #include "platform.h" |
28 | #include "gnunet_crypto_lib.h" | 26 | #include "gnunet_crypto_lib.h" |
29 | #include "gnunet_strings_lib.h" | 27 | #include "gnunet_strings_lib.h" |
28 | #include "gnunet_os_lib.h" | ||
30 | #include "gnunet_configuration_lib.h" | 29 | #include "gnunet_configuration_lib.h" |
31 | #include "gnunet_disk_lib.h" | 30 | #include "gnunet_disk_lib.h" |
32 | 31 | ||
@@ -118,7 +117,85 @@ struct DiffHandle | |||
118 | struct GNUNET_CONFIGURATION_Handle * | 117 | struct GNUNET_CONFIGURATION_Handle * |
119 | GNUNET_CONFIGURATION_create () | 118 | GNUNET_CONFIGURATION_create () |
120 | { | 119 | { |
121 | return GNUNET_new (struct GNUNET_CONFIGURATION_Handle); | 120 | struct GNUNET_CONFIGURATION_Handle *cfg; |
121 | char *p; | ||
122 | |||
123 | cfg = GNUNET_new (struct GNUNET_CONFIGURATION_Handle); | ||
124 | /* make certain values from the project data available | ||
125 | as PATHS */ | ||
126 | p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); | ||
127 | if (NULL != p) | ||
128 | { | ||
129 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
130 | "PATHS", | ||
131 | "DATADIR", | ||
132 | p); | ||
133 | GNUNET_free (p); | ||
134 | } | ||
135 | p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBDIR); | ||
136 | if (NULL != p) | ||
137 | { | ||
138 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
139 | "PATHS", | ||
140 | "LIBDIR", | ||
141 | p); | ||
142 | GNUNET_free (p); | ||
143 | } | ||
144 | p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR); | ||
145 | if (NULL != p) | ||
146 | { | ||
147 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
148 | "PATHS", | ||
149 | "BINDIR", | ||
150 | p); | ||
151 | GNUNET_free (p); | ||
152 | } | ||
153 | p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX); | ||
154 | if (NULL != p) | ||
155 | { | ||
156 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
157 | "PATHS", | ||
158 | "PREFIX", | ||
159 | p); | ||
160 | GNUNET_free (p); | ||
161 | } | ||
162 | p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LOCALEDIR); | ||
163 | if (NULL != p) | ||
164 | { | ||
165 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
166 | "PATHS", | ||
167 | "LOCALEDIR", | ||
168 | p); | ||
169 | GNUNET_free (p); | ||
170 | } | ||
171 | p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_ICONDIR); | ||
172 | if (NULL != p) | ||
173 | { | ||
174 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
175 | "PATHS", | ||
176 | "ICONDIR", | ||
177 | p); | ||
178 | GNUNET_free (p); | ||
179 | } | ||
180 | p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DOCDIR); | ||
181 | if (NULL != p) | ||
182 | { | ||
183 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
184 | "PATHS", | ||
185 | "DOCDIR", | ||
186 | p); | ||
187 | GNUNET_free (p); | ||
188 | } | ||
189 | p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBEXECDIR); | ||
190 | if (NULL != p) | ||
191 | { | ||
192 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
193 | "PATHS", | ||
194 | "LIBEXECDIR", | ||
195 | p); | ||
196 | GNUNET_free (p); | ||
197 | } | ||
198 | return cfg; | ||
122 | } | 199 | } |
123 | 200 | ||
124 | 201 | ||