[gamin] Define path to gamin config file through env variable
- From: Christian Reiber <christian reiber zeppelin com>
- To: gamin-list gnome org
- Subject: [gamin] Define path to gamin config file through env variable
- Date: Sat, 7 Jun 2008 16:47:58 +0200
Hi,
I needed a way to tell gamin explicitely where to find its config file.
The available alternatives did not work for me because gamin runs in a
setup where I want to keep config files self-contained in the application
setup and not in some "global" or "well-known" location.
I patched server/gam_conf.c so that an environment variable
GAMIN_CONFIG_FILE is checked in the first place which should contain the
path to the config file (including the filename). The usual sequence of
looking up config file entries is unaffected as the environment variable
just changes the default for the user config file (~/.gaminrc).
Below is the patch. To apply it go to the directory where your gamin-0.1.9
directory sits and patch with "patch -p0 <patchfile". It would be great if
it could make it into the next gamin release.
Christian
### patch starts ###
diff -Nur gamin-0.1.9/server/gam_conf.c
gamin-0.1.9-patched/server/gam_conf.c
--- gamin-0.1.9/server/gam_conf.c 2007-07-04 13:36:49.000000000
+0000
+++ gamin-0.1.9-patched/server/gam_conf.c 2008-03-09
16:42:08.377215240 +0000
@@ -111,7 +111,14 @@
const char *globalconf = "/etc/gamin/gaminrc";
const char *mandatory = "/etc/gamin/mandatory_gaminrc";
gchar *userconf = NULL;
- userconf = g_strconcat(g_get_home_dir(), "/.gaminrc", NULL);
+
+ /* user config file path may be overridden by env variable */
+ userconf = g_strdup(g_getenv("GAMIN_CONFIG_FILE"));
+
+ if (userconf == NULL) {
+ userconf = g_strconcat(g_get_home_dir(), "/.gaminrc", NULL);
+ }
+
if (userconf == NULL) {
gam_conf_read_internal (globalconf);
return;
### patch ends ###
---------------------------------------------
Zeppelin Baumaschinen GmbH
Handelsregister - Commercial register: AG München HRB 107767
Sitz - Domicile: D-85748 Garching b. München
Vorsitzender des Aufsichtsrats - Chairman of the Supervisory Board:
Ernst Susanek
Geschäftsführer - Board of Management:
Michael Heidemann (Vorsitzender - Chairman), Christian Dummler
---------------------------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]