Blame SOURCES/0023-fix-loading-of-the-user-list-of-ignored-words.patch

27390d
From f689bf3b1dd26fa14bd96a2a5f0b8a6665d7ab19 Mon Sep 17 00:00:00 2001
27390d
From: Jakub Filak <jfilak@redhat.com>
27390d
Date: Thu, 30 Jan 2014 12:49:42 +0100
27390d
Subject: [LIBREPORT PATCH 23/24] fix loading of the user list of ignored words
27390d
27390d
Closes #1063339
27390d
27390d
Signed-off-by: Jakub Filak <jfilak@redhat.com>
27390d
---
27390d
 src/lib/user_settings.c | 18 ++++++++++++++----
27390d
 1 file changed, 14 insertions(+), 4 deletions(-)
27390d
27390d
diff --git a/src/lib/user_settings.c b/src/lib/user_settings.c
27390d
index e42ebe0..4cd87ff 100644
27390d
--- a/src/lib/user_settings.c
27390d
+++ b/src/lib/user_settings.c
27390d
@@ -18,19 +18,30 @@
27390d
 #include "internal_libreport.h"
27390d
 #include <augeas.h>
27390d
 
27390d
+#define BASE_DIR_FOR_USER_CONFIG_FILE "abrt/settings/"
27390d
+
27390d
 static map_string_t *user_settings;
27390d
 static char *conf_path;
27390d
 
27390d
-static char *get_conf_path(const char *name)
27390d
+static char *get_user_config_file_path(const char *name, const char *suffix)
27390d
 {
27390d
     char *s, *conf;
27390d
 
27390d
-    s = xasprintf("abrt/settings/%s.conf", name);
27390d
+    if (suffix != NULL)
27390d
+        s = xasprintf(BASE_DIR_FOR_USER_CONFIG_FILE"%s.%s", name, suffix);
27390d
+    else
27390d
+        s = xasprintf(BASE_DIR_FOR_USER_CONFIG_FILE"%s", name);
27390d
+
27390d
     conf = concat_path_file(g_get_user_config_dir(), s);
27390d
     free(s);
27390d
     return conf;
27390d
 }
27390d
 
27390d
+static char *get_conf_path(const char *name)
27390d
+{
27390d
+    return get_user_config_file_path(name, "conf");
27390d
+}
27390d
+
27390d
 bool save_app_conf_file(const char* application_name, map_string_t *settings)
27390d
 {
27390d
     char *app_conf_path = get_conf_path(application_name);
27390d
@@ -103,8 +114,7 @@ GList *load_words_from_file(const char* filename)
27390d
     GList *words_list = NULL;
27390d
     GList *file_list = NULL;
27390d
     file_list = g_list_prepend(file_list, concat_path_file(CONF_DIR, filename));
27390d
-    // get_conf_path adds .conf suffix, so we need to either change it or use it like this:
27390d
-    file_list = g_list_prepend(file_list, get_conf_path("forbidden_words"));
27390d
+    file_list = g_list_prepend(file_list, get_user_config_file_path(filename, /*don't append suffix*/NULL));
27390d
     GList *file_list_cur = file_list;
27390d
 
27390d
     while(file_list_cur)
27390d
-- 
27390d
1.8.3.1
27390d