#include "logging.h"
#include "util/CurlURLInputStream.h"
#include "util/NDC.h"
+#include "util/PathResolver.h"
#include "util/ParserPool.h"
#include "util/Threads.h"
#include "util/XMLHelper.h"
#include <functional>
#include <boost/algorithm/string.hpp>
#include <boost/bind.hpp>
-#include <boost/tokenizer.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XMLUniDefs.hpp>
#include <xercesc/sax/SAXException.hpp>
bool ParserPool::loadCatalogs(const char* pathnames)
{
string temp(pathnames);
- boost::tokenizer< char_separator<char> > catpaths(temp, char_separator<char>(PATH_SEPARATOR_STR));
- for_each(
- catpaths.begin(), catpaths.end(),
- // Call loadCatalog with an inner call to s->c_str() on each entry.
- boost::bind(static_cast<bool (ParserPool::*)(const char*)>(&ParserPool::loadCatalog), this, boost::bind(&string::c_str, _1))
- );
- return catpaths.begin() != catpaths.end();
+ vector<string> catpaths;
+ split(catpaths, temp, is_any_of(PATH_SEPARATOR_STR), algorithm::token_compress_on);
+ for (vector<string>::iterator i = catpaths.begin(); i != catpaths.end(); ++i) {
+ XMLToolingConfig::getConfig().getPathResolver()->resolve(*i, PathResolver::XMLTOOLING_XML_FILE);
+ loadCatalog(i->c_str());
+ }
+ return !catpaths.empty();
}
bool ParserPool::loadCatalog(const char* pathname)
const string& PathResolver::resolve(string& s, file_type_t filetype, const char* pkgname, const char* prefix) const
{
+#ifdef WIN32
+ // Check for possible environment variable(s).
+ if (s.find('%') != string::npos) {
+ char expbuf[MAX_PATH + 2];
+ DWORD cnt = ExpandEnvironmentStrings(s.c_str(), expbuf, sizeof(expbuf));
+ if (cnt != 0 && cnt <= sizeof(expbuf))
+ s = expbuf;
+ }
+#endif
+
if (!isAbsolute(s.c_str())) {
switch (filetype) {
case XMLTOOLING_LIB_FILE: