[goffice] win32: fix more configuration trouble.



commit 0a15ef6a10fad5bed1859b130d9107d9630cf3fd
Author: Morten Welinder <terra gnome org>
Date:   Tue May 4 22:39:35 2010 -0400

    win32: fix more configuration trouble.

 ChangeLog                   |    1 +
 goffice/app/go-conf-win32.c |   18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 17fe7e8..4509c0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
 	* goffice/app/go-conf-win32.c (go_conf_win32_get): Restore last
 	backslash for error messages.
 	(go_conf_set_bool): Set the right value.  Fixes #617672.
+	(go_conf_get_node): Don't create too-deep directory structure.
 
 2010-05-03  Morten Welinder  <terra gnome org>
 
diff --git a/goffice/app/go-conf-win32.c b/goffice/app/go-conf-win32.c
index 3d504f8..c04abcf 100644
--- a/goffice/app/go-conf-win32.c
+++ b/goffice/app/go-conf-win32.c
@@ -230,11 +230,27 @@ GOConfNode *
 go_conf_get_node (GOConfNode *parent, const gchar *key)
 {
 	gchar *win32_key = go_conf_get_win32_key (parent, key);
+	gchar *last_sep = strrchr (win32_key, '\\');
 	HKEY hKey;
 	gboolean is_new;
 	GOConfNode *node = NULL;
+	gboolean err;
+
+	if (last_sep) {
+		*last_sep = 0;
+		/*
+		 * This probably produces the wrong hKey because it refers
+		 * to the directory, not the node.  We need to cut the last
+		 * component, or else we get a new, empty, directory.
+		 */
+		err = go_conf_win32_get_node (&hKey, win32_key, &is_new);
+		*last_sep = '\\';
+	} else {
+		err = TRUE;
+		is_new = TRUE;
+	}
 
-	if (go_conf_win32_get_node (&hKey, win32_key, &is_new)) {
+	if (err) {
 		if (!parent && is_new) {
 			gchar *path;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]