Include conf from filters-enabled
[metaproxy-moved-to-github.git] / src / metaproxy_prog.cpp
index 4cba424..ef4f8f1 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of Metaproxy.
-   Copyright (C) 2005-2009 Index Data
+   Copyright (C) 2005-2010 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
@@ -27,8 +27,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <stdexcept>
 #include <libxml/xinclude.h>
 
-#include "filter.hpp"
-#include "package.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
 #include "router_flexml.hpp"
 #include "factory_static.hpp"
 
@@ -150,8 +150,20 @@ static int sc_main(
             yaz_log(YLOG_FATAL, "XInclude processing failed");
             return 1;
         }
+        WRBUF base_path = wrbuf_alloc();
+        const char *last_p = strrchr(fname,
+#ifdef WIN32
+                                     '\\'
+#else
+                                     '/'
+#endif
+            );
+        if (last_p)
+            wrbuf_write(base_path, fname, last_p - fname);
+        
         mp::FactoryStatic factory;
-        mp::RouterFleXML router(doc, factory, false);
+        mp::RouterFleXML router(doc, factory, false, wrbuf_cstr(base_path));
+        wrbuf_destroy(base_path);
 
         yaz_sc_running(s);