summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/configmanager.cpp6
-rw-r--r--src/gui/windowmanager_unittest.cc14
2 files changed, 20 insertions, 0 deletions
diff --git a/src/configmanager.cpp b/src/configmanager.cpp
index e79753a66..953a7c2e7 100644
--- a/src/configmanager.cpp
+++ b/src/configmanager.cpp
@@ -69,6 +69,12 @@ void ConfigManager::initServerConfig(const std::string &serverName)
{
configFile = fopen(configPath.c_str(), "wt");
logger->log("Creating new server config: " + configPath);
+ if (configFile)
+ {
+ fputs("<?xml version=\"1.0\"?>\n", configFile);
+ fputs("<configuration>\n", configFile);
+ fputs("</configuration>\n", configFile);
+ }
}
if (configFile)
{
diff --git a/src/gui/windowmanager_unittest.cc b/src/gui/windowmanager_unittest.cc
index 58f85ec2a..78bd85ab8 100644
--- a/src/gui/windowmanager_unittest.cc
+++ b/src/gui/windowmanager_unittest.cc
@@ -20,7 +20,9 @@
#include "catch.hpp"
#include "client.h"
+#include "configmanager.h"
#include "configuration.h"
+#include "dirs.h"
#include "graphicsmanager.h"
#include "settings.h"
#include "textcommand.h"
@@ -122,6 +124,8 @@
#include "utils/translation/translationmanager.h"
+#include <stdio.h>
+
#include "debug.h"
extern QuitDialog *quitDialog;
@@ -161,6 +165,16 @@ TEST_CASE("Windows tests", "windowmanager")
theme = new Theme;
Theme::selectSkin();
+ Dirs::initRootDir();
+ Dirs::initHomeDir();
+
+ const std::string cfgName = settings.configDir +
+ "/nonexistserver/config.xml";
+ ::remove(cfgName.c_str());
+
+ ConfigManager::initConfiguration();
+ ConfigManager::initServerConfig("nonexistserver");
+
localPlayer = new LocalPlayer(static_cast<BeingId>(1),
BeingTypeId_zero);