X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Ffilter_cql_to_rpn.cpp;h=322eb4628b43a36e865cd9170b66697f36108e80;hb=1be1a231bf51e92d9dd443282f9666ab7a0b4ca7;hp=d69612429e073a89e540e0ec6da7f012f7266bfe;hpb=5f0d3fb3aa612b9a9ba2a9c756bcf3117a10d959;p=metaproxy-moved-to-github.git diff --git a/src/filter_cql_to_rpn.cpp b/src/filter_cql_to_rpn.cpp index d696124..322eb46 100644 --- a/src/filter_cql_to_rpn.cpp +++ b/src/filter_cql_to_rpn.cpp @@ -1,5 +1,5 @@ /* This file is part of Metaproxy. - Copyright (C) 2005-2012 Index Data + Copyright (C) 2005-2013 Index Data Metaproxy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include #include - +#include namespace mp = metaproxy_1; namespace yf = metaproxy_1::filter; @@ -42,7 +42,7 @@ namespace metaproxy_1 { Impl(); ~Impl(); void process(metaproxy_1::Package & package); - void configure(const xmlNode * ptr); + void configure(const xmlNode *ptr, const char *path); private: yazpp_1::Yaz_cql2rpn m_cql2rpn; }; @@ -63,7 +63,7 @@ yf::CQLtoRPN::~CQLtoRPN() void yf::CQLtoRPN::configure(const xmlNode *xmlnode, bool test_only, const char *path) { - m_p->configure(xmlnode); + m_p->configure(xmlnode, path); } void yf::CQLtoRPN::process(mp::Package &package) const @@ -82,7 +82,7 @@ yf::CQLtoRPN::Impl::~Impl() { } -void yf::CQLtoRPN::Impl::configure(const xmlNode *xmlnode) +void yf::CQLtoRPN::Impl::configure(const xmlNode *xmlnode, const char *path) { /* @@ -122,8 +122,14 @@ void yf::CQLtoRPN::Impl::configure(const xmlNode *xmlnode) "for filter cql_rpn"); } + + char fullpath[1024]; + if (!yaz_filepath_resolve(fname.c_str(), path, 0, fullpath)) + { + throw mp::filter::FilterException("Could not open " + fname); + } int error = 0; - if (!m_cql2rpn.parse_spec_file(fname.c_str(), &error)) + if (!m_cql2rpn.parse_spec_file(fullpath, &error)) { throw mp::filter::FilterException("Bad or missing " "CQL to RPN configuration " @@ -188,7 +194,7 @@ static mp::filter::Base* filter_creator() } extern "C" { - struct metaproxy_1_filter_struct metaproxy_1_filter_cql_to_rpn = { + struct metaproxy_1_filter_struct metaproxy_1_filter_cql_rpn = { 0, "cql_rpn", filter_creator