From: Adam Dickmeiss Date: Thu, 5 Mar 2009 11:48:57 +0000 (+0100) Subject: Path fixes for Windows. Settings uses base conf directory. X-Git-Tag: v1.1.0~34^2^2^2~2 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=56a3131257cf162bc9fdccb9c9eeec96474d1f90;p=pazpar2-moved-to-github.git Path fixes for Windows. Settings uses base conf directory. --- 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))