summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client.cpp15
-rw-r--r--src/client.h6
-rw-r--r--src/commandhandler.cpp2
3 files changed, 22 insertions, 1 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 5d43afbf5..1d1fdeaa5 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -295,6 +295,7 @@ void Client::testsInit()
{
logger = new Logger;
initLocalDataDir();
+ initTempDir();
initConfigDir();
}
}
@@ -1635,6 +1636,7 @@ void Client::initRootDir()
void Client::initHomeDir()
{
initLocalDataDir();
+ initTempDir();
initConfigDir();
}
@@ -1666,7 +1668,18 @@ void Client::initLocalDataDir()
if (mkdir_r(mLocalDataDir.c_str()))
{
logger->error(strprintf(_("%s doesn't exist and can't be created! "
- "Exiting."), mLocalDataDir.c_str()));
+ "Exiting."), mLocalDataDir.c_str()));
+ }
+}
+
+void Client::initTempDir()
+{
+ mTempDir = mLocalDataDir + PHYSFS_getDirSeparator() + "temp";
+
+ if (mkdir_r(mTempDir.c_str()))
+ {
+ logger->error(strprintf(_("%s doesn't exist and can't be created! "
+ "Exiting."), mTempDir.c_str()));
}
}
diff --git a/src/client.h b/src/client.h
index 87786856e..3bfd68fa5 100644
--- a/src/client.h
+++ b/src/client.h
@@ -230,6 +230,9 @@ public:
static const std::string &getLocalDataDirectory()
{ return instance()->mLocalDataDir; }
+ static const std::string &getTempDirectory()
+ { return instance()->mTempDir; }
+
static const std::string &getScreenshotDirectory()
{ return instance()->mScreenshotDir; }
@@ -315,6 +318,8 @@ private:
void initLocalDataDir();
+ void initTempDir();
+
void initConfigDir();
void initUpdatesDir();
@@ -342,6 +347,7 @@ private:
std::string mPackageDir;
std::string mConfigDir;
std::string mLocalDataDir;
+ std::string mTempDir;
std::string mUpdateHost;
std::string mUpdatesDir;
std::string mScreenshotDir;
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 8fab8e042..6a5e9fcef 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -915,6 +915,8 @@ void CommandHandler::handleDirs(const std::string &args A_UNUSED,
+ Client::getLocalDataDirectory());
debugChatTab->chatLog("screenshots directory: "
+ Client::getScreenshotDirectory());
+ debugChatTab->chatLog("temp directory: "
+ + Client::getTempDirectory());
}
void CommandHandler::handleInfo(const std::string &args A_UNUSED,