063c337
From 7e71ffbea05e79230e7c0e3a0a14d305c6779cc0 Mon Sep 17 00:00:00 2001
063c337
From: Jakub Filak <jfilak@redhat.com>
063c337
Date: Fri, 11 Mar 2016 15:15:09 +0100
063c337
Subject: [PATCH] workflows: NULL for the default configuration dir
063c337
063c337
Other projects should not bother with passing the path to the default
063c337
configuration directory.
063c337
063c337
Signed-off-by: Jakub Filak <jfilak@redhat.com>
063c337
---
063c337
 src/include/workflow.h | 10 +++++++++-
063c337
 src/lib/workflow.c     |  6 ++++++
063c337
 2 files changed, 15 insertions(+), 1 deletion(-)
063c337
063c337
diff --git a/src/include/workflow.h b/src/include/workflow.h
063c337
index c707007..63ca97e 100644
063c337
--- a/src/include/workflow.h
063c337
+++ b/src/include/workflow.h
063c337
@@ -58,13 +58,21 @@ void wf_set_priority(workflow_t *w, int priority);
063c337
  */
063c337
 int wf_priority_compare(const workflow_t *first, const workflow_t *second);
063c337
 
063c337
+/* The function loads workflow XML configuration files for the workflows listed
063c337
+ * in the wf_names argument. The XML files are searched in a directory at path.
063c337
+ *
063c337
+ * @param wf_names Required workflow names
063c337
+ * @param path y File system path to directory with workflow XML
063c337
+ * configuration files. If NULL, the default 'WORKFLOWS_DIR' is used instead.
063c337
+ * @returns A map where the key is workflow's name and the value is workflow_t *.
063c337
+ */
063c337
 GHashTable *load_workflow_config_data_from_list(GList *wf_names, const char *path);
063c337
 
063c337
 /* The function loads all workflow XML configuration files placed in the given
063c337
  * directory.
063c337
  *
063c337
  * @param directory File system path to directory with workflow XML
063c337
- * configuration files.
063c337
+ * configuration files. If NULL, the default 'WORKFLOWS_DIR' is used instead.
063c337
  * @returns A map where the key is workflow's name and the value is workflow_t *.
063c337
  */
063c337
 #define load_workflow_config_data libreport_load_workflow_config_data
063c337
diff --git a/src/lib/workflow.c b/src/lib/workflow.c
063c337
index a985834..c74dad1 100644
063c337
--- a/src/lib/workflow.c
063c337
+++ b/src/lib/workflow.c
063c337
@@ -105,6 +105,9 @@ GHashTable *load_workflow_config_data_from_list(GList *wf_names,
063c337
                          (GDestroyNotify) free_workflow
063c337
         );
063c337
 
063c337
+    if (path == NULL)
063c337
+        path = WORKFLOWS_DIR;
063c337
+
063c337
     GList *workflow_files = get_file_list(path, "xml");
063c337
     while(wfs)
063c337
     {
063c337
@@ -131,6 +134,9 @@ GHashTable *load_workflow_config_data(const char *path)
063c337
         );
063c337
     }
063c337
 
063c337
+    if (path == NULL)
063c337
+        path = WORKFLOWS_DIR;
063c337
+
063c337
     GList *workflow_files = get_file_list(path, "xml");
063c337
     while (workflow_files)
063c337
     {
063c337
-- 
063c337
2.5.5
063c337