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