[ohm] ohm: Branch 'master'

Richard Hughes hughsient at kemper.freedesktop.org
Wed Jul 25 06:46:57 PDT 2007


 ohmd/ohm-conf.c   |   13 +++++++++----
 ohmd/ohm-module.c |   18 +++++++++---------
 2 files changed, 18 insertions(+), 13 deletions(-)

New commits:
diff-tree a745bd13c8df49777cd1b2919f18bfa2d4bd8c34 (from 1b5b6d6ab089fc48566df181f9667a547607d9a8)
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Jul 25 14:42:14 2007 +0100

    fix loading of the plugin conf directory when installed properly
    
    Fix Robs last commit which broke installation on the OLPC

diff --git a/ohmd/ohm-conf.c b/ohmd/ohm-conf.c
index ecd2f15..df982aa 100644
--- a/ohmd/ohm-conf.c
+++ b/ohmd/ohm-conf.c
@@ -430,6 +430,7 @@ ohm_conf_load_defaults (OhmConf     *con
 	gchar **lines;
 	guint i;
 	gchar *filename;
+	gchar *conf_dir;
 	gchar *inifile;
 
 	g_return_val_if_fail (OHM_IS_CONF (conf), FALSE);
@@ -439,11 +440,15 @@ ohm_conf_load_defaults (OhmConf     *con
 	inifile = g_strdup_printf ("%s.ini", plugin_name);
 
 	/* generate path for each module */
-	filename = getenv ("OHM_CONF_DIR");
-	if (!filename)
-		filename = g_build_path (G_DIR_SEPARATOR_S, SYSCONFDIR, "ohm", "plugins.d", NULL);
+	conf_dir = getenv ("OHM_CONF_DIR");
+	if (conf_dir != NULL) {
+		/* we have from the environment */
+		filename = g_build_path (G_DIR_SEPARATOR_S, conf_dir, "plugins.d", inifile, NULL);
+	} else {
+		/* we are running as normal */
+		filename = g_build_path (G_DIR_SEPARATOR_S, SYSCONFDIR, "ohm", "plugins.d", inifile, NULL);
+	}
 
-	filename = g_build_path (G_DIR_SEPARATOR_S, filename, "plugins.d", inifile, NULL);
 	g_free (inifile);
 
 	ohm_debug ("Loading %s defaults from %s", plugin_name, filename);
diff --git a/ohmd/ohm-module.c b/ohmd/ohm-module.c
index cc75407..182a025 100644
--- a/ohmd/ohm-module.c
+++ b/ohmd/ohm-module.c
@@ -280,6 +280,7 @@ ohm_module_read_defaults (OhmModule *mod
 {
 	GKeyFile *keyfile;
 	gchar *filename;
+	gchar *conf_dir;
 	gchar **modules;
 	gsize length;
 	guint i;
@@ -290,16 +291,15 @@ ohm_module_read_defaults (OhmModule *mod
 	keyfile = g_key_file_new ();
 
 	/* generate path for conf file */
-	filename = getenv ("OHM_CONF_DIR");
-
-	g_warning ("OHM_CONF_DIR=%s", filename);
-
-	if (!filename)
+	conf_dir = getenv ("OHM_CONF_DIR");
+	if (conf_dir != NULL) {
+		/* we have from the environment */
+		filename = g_build_path (G_DIR_SEPARATOR_S, conf_dir, "modules.ini", NULL);
+	} else {
+		/* we are running as normal */
 		filename = g_build_path (G_DIR_SEPARATOR_S, SYSCONFDIR, "ohm", "modules.ini", NULL);
-	else
-		filename = g_build_path (G_DIR_SEPARATOR_S, filename, "modules.ini", NULL);
-
-	g_warning ("keyfile = %s", filename);
+	}
+	ohm_debug ("keyfile = %s", filename);
 
 	/* we can never save the file back unless we remove G_KEY_FILE_NONE */
 	error = NULL;


More information about the Ohm-devel mailing list