summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game.cpp11
-rw-r--r--src/gui/recorder.cpp7
-rw-r--r--src/main.cpp5
-rw-r--r--src/main.h2
4 files changed, 14 insertions, 11 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 856288bc..6ce3a1e8 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -92,7 +92,6 @@
#include <guichan/focushandler.hpp>
#include <fstream>
-#include <physfs.h>
#include <sstream>
#include <string>
@@ -404,15 +403,13 @@ static bool saveScreenshot()
do {
screenshotCount++;
filename.str("");
- filenameSuffix.str("");
- filename << PHYSFS_getUserDir();
#if (defined __USE_UNIX98 || defined __FreeBSD__)
- filenameSuffix << ".mana/";
+ filename << getHomeDirectory();
#elif defined __APPLE__
- filenameSuffix << "Desktop/";
+ filename << PHYSFS_getUserDir();
+ filename << "Desktop/";
#endif
- filenameSuffix << "Mana_Screenshot_" << screenshotCount << ".png";
- filename << filenameSuffix.str();
+ filename << "Mana_Screenshot_" << screenshotCount << ".png";
testExists.open(filename.str().c_str(), std::ios::in);
found = !testExists.is_open();
testExists.close();
diff --git a/src/gui/recorder.cpp b/src/gui/recorder.cpp
index a86048c0..b4013d2a 100644
--- a/src/gui/recorder.cpp
+++ b/src/gui/recorder.cpp
@@ -28,11 +28,11 @@
#include "gui/widgets/layout.h"
#include "gui/widgets/windowcontainer.h"
+#include "main.h"
+
#include "utils/gettext.h"
#include "utils/stringutils.h"
-#include <physfs.h>
-
Recorder::Recorder(ChatWindow *chat, const std::string &title,
const std::string &buttonTxt) :
Window(title)
@@ -103,8 +103,7 @@ void Recorder::setRecordingFile(const std::string &msg)
* recorded.
*/
localChatTab->chatLog(_("Starting to record..."), BY_SERVER);
- const std::string file =
- std::string(PHYSFS_getUserDir()) + "/.mana/" + msgCopy;
+ const std::string file = std::string(getHomeDirectory() + msgCopy);
mStream.open(file.c_str(), std::ios_base::trunc);
diff --git a/src/main.cpp b/src/main.cpp
index 8ecac127..f2d61f07 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -694,6 +694,11 @@ public:
} // namespace
+const std::string &getHomeDirectory()
+{
+ return homeDir;
+}
+
// TODO Find some nice place for these functions
static void accountLogin(LoginData *loginData)
{
diff --git a/src/main.h b/src/main.h
index 3f8a6f5a..69222d4d 100644
--- a/src/main.h
+++ b/src/main.h
@@ -83,6 +83,8 @@
#define DEFAULT_PORT 6901
#endif
+const std::string &getHomeDirectory();
+
/*
* Client different States
*/