From 56a3131257cf162bc9fdccb9c9eeec96474d1f90 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 5 Mar 2009 12:48:57 +0100 Subject: [PATCH] Path fixes for Windows. Settings uses base conf directory. --- src/pazpar2_config.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/pazpar2_config.c b/src/pazpar2_config.c index b209f78..43d5bcf 100644 --- a/src/pazpar2_config.c +++ b/src/pazpar2_config.c @@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include #include +#include #define CONFIG_NOEXTERNS #include "pazpar2_config.h" @@ -402,7 +403,16 @@ static char *parse_settings(xmlNode *node) char *r; if (src) - r = nmem_strdup(nmem, (const char *) src); + { + if (yaz_is_abspath((const char *) src)) + r = nmem_strdup(nmem, (const char *) src); + else + { + r = nmem_malloc(nmem, + strlen(confdir) + strlen((const char *) src) + 2); + sprintf(r, "%s/%s", confdir, src); + } + } else { yaz_log(YLOG_FATAL, "Must specify src in targetprofile"); @@ -512,7 +522,7 @@ static struct conf_server *parse_server(xmlNode *node) xsltStylesheet *conf_load_stylesheet(const char *fname) { char path[256]; - if (*fname == '/') + if (yaz_is_abspath(fname)) yaz_snprintf(path, sizeof(path), fname); else yaz_snprintf(path, sizeof(path), "%s/%s", confdir, fname); @@ -611,7 +621,13 @@ int read_config(const char *fname) yaz_log(YLOG_FATAL, "Failed to read %s", fname); exit(1); } - if ((p = strrchr(fname, '/'))) + if ((p = strrchr(fname, +#ifdef WIN32 + '\\' +#else + '/' +#endif + ))) { int len = p - fname; if (len >= sizeof(confdir)) -- 1.7.10.4