summaryrefslogtreecommitdiff
path: root/src/common/configuration.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-08-21 23:37:47 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-08-22 00:26:47 +0200
commit296577b5a88732b8a97a3ebce7cda8f92ab7511f (patch)
treef15596785e8e842f056b6e390d7c5227091898c9 /src/common/configuration.cpp
parent40579ae75e0ae9db204a864ac0738234098f707c (diff)
downloadmanaserv-296577b5a88732b8a97a3ebce7cda8f92ab7511f.tar.gz
manaserv-296577b5a88732b8a97a3ebce7cda8f92ab7511f.tar.bz2
manaserv-296577b5a88732b8a97a3ebce7cda8f92ab7511f.tar.xz
manaserv-296577b5a88732b8a97a3ebce7cda8f92ab7511f.zip
Changed the location of configuration, logs and stats
Instead of searching for the configuration file in ~/.manaserv.xml, the file is now expected to be in the working directory of the server. The logs and statistics will also be written there. This should make it easier to run differently configured servers on the same machine, and should also be a bit more straight-forward to setup. Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src/common/configuration.cpp')
-rw-r--r--src/common/configuration.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/common/configuration.cpp b/src/common/configuration.cpp
index 80364b0b..0f0a5844 100644
--- a/src/common/configuration.cpp
+++ b/src/common/configuration.cpp
@@ -1,6 +1,7 @@
/*
* The Mana Server
* Copyright (C) 2004-2010 The Mana World Development Team
+ * Copyright (C) 2010 The Mana Developers
*
* This file is part of The Mana Server.
*
@@ -32,19 +33,23 @@ static std::map< std::string, std::string > options;
/**< Location of config file. */
static std::string configPath;
-void Configuration::initialize(const std::string &filename)
+bool Configuration::initialize(const std::string &filename)
{
configPath = filename;
xmlDocPtr doc = xmlReadFile(filename.c_str(), NULL, 0);
- if (!doc) return;
+ if (!doc) {
+ LOG_WARN("Could not read configuration file '" << filename.c_str() << "'.");
+ return false;
+ }
xmlNodePtr node = xmlDocGetRootElement(doc);
if (!node || !xmlStrEqual(node->name, BAD_CAST "configuration")) {
LOG_WARN("No configuration file '" << filename.c_str() << "'.");
- return;
+ xmlFreeDoc(doc);
+ return false;
}
for (node = node->xmlChildrenNode; node != NULL; node = node->next)
@@ -62,6 +67,7 @@ void Configuration::initialize(const std::string &filename)
}
xmlFreeDoc(doc);
+ return true;
}
void Configuration::deinitialize()