X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Fpazpar2_config.c;h=785293e7a754b98b7260912b9c93d3318e7acfd2;hb=a9ec798ec65f4114a4fd3d2479d31efe25411d08;hp=1aef7b40112c406642cca43f138127ca8f507f50;hpb=82d7d0c694b86d3e4ca429d47624ea0f8bc19b91;p=pazpar2-moved-to-github.git diff --git a/src/pazpar2_config.c b/src/pazpar2_config.c index 1aef7b4..785293e 100644 --- a/src/pazpar2_config.c +++ b/src/pazpar2_config.c @@ -54,6 +54,7 @@ struct conf_config int no_threads; WRBUF confdir; + char *path; iochan_man_t iochan_man; database_hosts_t database_hosts; }; @@ -256,13 +257,20 @@ int conf_service_sortkey_field_id(struct conf_service *service, static void conf_dir_path(struct conf_config *config, WRBUF w, const char *src) { - if (config->confdir && wrbuf_len(config->confdir) > 0 && - !yaz_is_abspath(src)) + char full_path[1024]; + if (yaz_filepath_resolve(src, config->path, + wrbuf_len(config->confdir) > 0 ? + wrbuf_cstr(config->confdir) : ".", + full_path)) { - wrbuf_printf(w, "%s/%s", wrbuf_cstr(config->confdir), src); + wrbuf_puts(w, full_path); } else + { + yaz_log(YLOG_WARN, "File not found: fname=%s path=%s base=%s", src, + config->path, wrbuf_cstr(config->confdir)); wrbuf_puts(w, src); + } } void service_destroy(struct conf_service *service) @@ -641,8 +649,8 @@ static struct conf_service *service_create_static(struct conf_server *server, { if (!service->charsets) service->charsets = pp2_charset_fact_create(); - if (pp2_charset_fact_define(service->charsets, - n->children, (const char *) n->name)) + if (pp2_charset_fact_define(service->charsets, n, + (const char *) n->name)) { yaz_log(YLOG_FATAL, "ICU chain definition error"); return 0; @@ -680,7 +688,7 @@ static struct conf_service *service_create_static(struct conf_server *server, service->rank_cluster = 1; else if (!strcmp(rank_cluster, "no")) service->rank_cluster = 0; - else + else { yaz_log(YLOG_FATAL, "service: rank@cluster boolean"); return 0; @@ -944,8 +952,8 @@ static struct conf_server *server_create(struct conf_config *config, { if (!server->charsets) server->charsets = pp2_charset_fact_create(); - if (pp2_charset_fact_define(server->charsets, - n->children, (const char *) n->name)) + if (pp2_charset_fact_define(server->charsets, n, + (const char *) n->name)) { yaz_log(YLOG_FATAL, "ICU chain definition error"); return 0; @@ -1244,6 +1252,15 @@ static int parse_config(struct conf_config *config, xmlNode *root) xmlFree(number); } } + else if (!strcmp((const char *) n->name, "file")) + { + xmlChar *path = xmlGetProp(n, (xmlChar *) "path"); + if (path) + { + config->path = nmem_strdup(config->nmem, (const char *) path); + xmlFree(path); + } + } else if (!strcmp((const char *) n->name, "targetprofiles")) { yaz_log(YLOG_FATAL, "targetprofiles unsupported here. Must be part of service"); @@ -1290,6 +1307,7 @@ struct conf_config *config_create(const char *fname, int verbose) config->nmem = nmem; config->servers = 0; + config->path = nmem_strdup(nmem, "."); config->no_threads = 0; config->iochan_man = 0; config->database_hosts = database_hosts_create();