summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorBernd Wachter <bwachter-tmw@lart.info>2010-02-25 14:50:23 +0100
committerBernd Wachter <bwachter-tmw@lart.info>2010-02-25 21:58:32 +0100
commit2ebd55fdcd7e177be150f9c5bdd1cbff9b110ad3 (patch)
tree50b9b47a6be0a2084097bca75d3eae9d6cc07bf9 /src/client.cpp
parent4df9004a4f4cfa1f1ec1e9a8ae6540710f32b0e2 (diff)
downloadmana-2ebd55fdcd7e177be150f9c5bdd1cbff9b110ad3.tar.gz
mana-2ebd55fdcd7e177be150f9c5bdd1cbff9b110ad3.tar.bz2
mana-2ebd55fdcd7e177be150f9c5bdd1cbff9b110ad3.tar.xz
mana-2ebd55fdcd7e177be150f9c5bdd1cbff9b110ad3.zip
Use recursive mkdir for config directories, fix log initialization
Logger now logs to stdout by default, and allows logging without having a log file open. This allows using logger for error logging in early startup functions. Reviewed-by: Jared Adams
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 5651f968..9ef6bc96 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -73,6 +73,7 @@
#include "resources/resourcemanager.h"
#include "utils/gettext.h"
+#include "utils/mkdir.h"
#include "utils/stringutils.h"
#ifdef __APPLE__
@@ -204,6 +205,8 @@ Client::Client(const Options &options):
assert(!mInstance);
mInstance = this;
+ logger = new Logger;
+
// Load branding information
if (!options.brandingPath.empty())
{
@@ -214,7 +217,6 @@ Client::Client(const Options &options):
initScreenshotDir(options.screenshotDir);
// Configure logger
- logger = new Logger;
logger->setLogFile(homeDir + std::string("/mana.log"));
// Log the mana version
@@ -970,14 +972,8 @@ void Client::initHomeDir(const Options &options)
"/." + branding.getValue("appShort", "mana");
#endif
}
-#if defined WIN32
- if (!CreateDirectory(homeDir.c_str(), 0) &&
- GetLastError() != ERROR_ALREADY_EXISTS)
-#else
- // Create home directory if it doesn't exist already
- if ((mkdir(homeDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) &&
- (errno != EEXIST))
-#endif
+
+ if (mkdir_r(homeDir.c_str()))
{
logger->error(strprintf(_("%s doesn't exist and can't be created! "
"Exiting."), homeDir.c_str()));