diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-03-23 22:06:33 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-03-24 19:08:09 +0100 |
commit | a3dc6e19b1cb7eec1dcbbcef5d370f4ab55a9ade (patch) | |
tree | 91b7bd840756eff88d59617054854d55bb5910d2 /src/common | |
parent | 94d97450bc3a52cd90baa696320bd08d91ac301f (diff) | |
download | manaserv-a3dc6e19b1cb7eec1dcbbcef5d370f4ab55a9ade.tar.gz manaserv-a3dc6e19b1cb7eec1dcbbcef5d370f4ab55a9ade.tar.bz2 manaserv-a3dc6e19b1cb7eec1dcbbcef5d370f4ab55a9ade.tar.xz manaserv-a3dc6e19b1cb7eec1dcbbcef5d370f4ab55a9ade.zip |
Rely more on the functionality in XML::Document
By default XML::Document will use the ResourceManager to resolve the
file name you pass to it. There is no point in disabling that
functionality only to resolve it manually.
Reviewed-by: Jared Adams
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/configuration.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/common/configuration.cpp b/src/common/configuration.cpp index 9d0e81ee..89b77e32 100644 --- a/src/common/configuration.cpp +++ b/src/common/configuration.cpp @@ -38,18 +38,11 @@ bool Configuration::initialize(const std::string &filename) { configPath = filename; - xmlDocPtr doc = xmlReadFile(filename.c_str(), NULL, 0); - - if (!doc) { - LOG_WARN("Could not read configuration file '" << filename.c_str() << "'."); - return false; - } - - xmlNodePtr node = xmlDocGetRootElement(doc); + XML::Document doc(filename, false); + xmlNodePtr node = doc.rootNode(); if (!node || !xmlStrEqual(node->name, BAD_CAST "configuration")) { LOG_WARN("No configuration file '" << filename.c_str() << "'."); - xmlFreeDoc(doc); return false; } @@ -67,7 +60,6 @@ bool Configuration::initialize(const std::string &filename) options[key] = value; } - xmlFreeDoc(doc); return true; } |