From b261817dceb9845e94902203d278c6626d0e5509 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 22 Apr 2017 22:22:57 +0300 Subject: Fix warning about missing configuration at first run. --- src/configuration.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/configuration.cpp') 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()); -- cgit v1.2.3-70-g09d2