The API in this file is used to read the environment configuration file and set up a number of environment variables based on the values found in it.
More...
|
| file | gnc-environment.h |
| | code to set up the environment for proper gnucash functioning.
|
| |
|
| void | gnc_environment_setup (void) |
| | Parse <prefix>/etc/gnucash/environment and set environment variables based on the contents of that file. More...
|
| |
The API in this file is used to read the environment configuration file and set up a number of environment variables based on the values found in it.
These parameters can be used to configure certain aspects of gnucash or components it depends on.
For example if not installed in the standard prefix "/usr", environment variable XDG_DATA_DIRS should be set such that glib can find the gsettings schemas installed by GnuCash and yelp can find the help file and guide (if these are installed).
◆ gnc_environment_setup()
| void gnc_environment_setup |
( |
void |
| ) |
|
Parse <prefix>/etc/gnucash/environment and set environment variables based on the contents of that file.
Read the comments in <prefix>/etc/gnucash/environment for more details.
Definition at line 184 of file gnc-environment.c.
191 env_parm = gnc_path_get_prefix();
192 if (!g_setenv(
"GNC_HOME", env_parm, TRUE))
193 g_warning (
"Couldn't set/override environment variable GNC_HOME.");
195 env_parm = gnc_path_get_bindir();
196 if (!g_setenv(
"GNC_BIN", env_parm, TRUE))
197 g_warning (
"Couldn't set/override environment variable GNC_BIN.");
199 env_parm = gnc_path_get_pkglibdir();
200 if (!g_setenv(
"GNC_LIB", env_parm, TRUE))
201 g_warning (
"Couldn't set/override environment variable GNC_LIB.");
203 env_parm = gnc_path_get_pkgdatadir();
204 if (!g_setenv(
"GNC_DATA", env_parm, TRUE))
205 g_warning (
"Couldn't set/override environment variable GNC_DATA.");
207 env_parm = gnc_path_get_pkgsysconfdir();
208 if (!g_setenv(
"GNC_CONF", env_parm, TRUE))
209 g_warning (
"Couldn't set/override environment variable GNC_CONF.");
211 env_parm = gnc_path_get_libdir();
212 if (!g_setenv(
"SYS_LIB", env_parm, TRUE))
213 g_warning (
"Couldn't set/override environment variable SYS_LIB.");
216 config_path = gnc_path_get_pkgsysconfdir();
220 gchar *pathext = g_build_path(
";",
".", g_getenv(
"PATHEXT"),
222 g_setenv(
"PATHEXT", pathext, TRUE);
228 env_path = g_build_filename (config_path,
"environment", NULL);
229 gnc_environment_parse_one(env_path);
233 env_path = g_build_filename (config_path,
"environment.local", NULL);
234 gnc_environment_parse_one(env_path);
236 g_free (config_path);