summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-04-22 22:22:57 +0300
committerAndrei Karas <akaras@inbox.ru>2017-04-22 22:22:57 +0300
commitb261817dceb9845e94902203d278c6626d0e5509 (patch)
treedaeb84ada3c596fac51241e3bbc62d9ceb085e9e /src
parent26ada73e5178d75e7a1ecef074976b1c956d972f (diff)
downloadmanaplus-b261817dceb9845e94902203d278c6626d0e5509.tar.gz
manaplus-b261817dceb9845e94902203d278c6626d0e5509.tar.bz2
manaplus-b261817dceb9845e94902203d278c6626d0e5509.tar.xz
manaplus-b261817dceb9845e94902203d278c6626d0e5509.zip
Fix warning about missing configuration at first run.
Diffstat (limited to 'src')
-rw-r--r--src/configuration.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp
index ef2442d3c..23ffed530 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -24,8 +24,11 @@
#include "variabledata.h"
+#include "fs/files.h"
#include "fs/paths.h"
+#include "fs/virtfs/virtfs.h"
+
#include "listeners/configlistener.h"
#include "utils/checkutils.h"
@@ -748,9 +751,7 @@ void Configuration::init(const std::string &filename,
const SkipError skipError)
{
cleanDefaults();
- XML::Document doc(filename,
- useResManager,
- skipError);
+ clear();
mFilename = filename;
mUseResManager = useResManager;
@@ -758,15 +759,28 @@ void Configuration::init(const std::string &filename,
{
mConfigPath = "virtfs://" + filename;
mDirectory.clear();
+ if (VirtFs::exists(filename) == false)
+ {
+ logger->log("Warning: No configuration file (%s)", filename.c_str());
+ return;
+ }
}
else
{
mConfigPath = filename;
logger->log1("init 1");
mDirectory = getRealPath(getFileDir(filename));
+ if (Files::existsLocal(filename) == false)
+ {
+ logger->log("Warning: No configuration file (%s)", filename.c_str());
+ return;
+ }
}
- logger->log1("init 2");
+ XML::Document doc(filename,
+ useResManager,
+ skipError);
+ logger->log1("init 2");
if (!doc.rootNode())
{
logger->log("Couldn't open configuration file: %s", filename.c_str());