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