summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorFate <fate-tmw@googlemail.com>2008-12-10 14:26:53 -0700
committerFate <fate-tmw@googlemail.com>2008-12-10 14:26:53 -0700
commit7d5c6124e9c9cf447286eaa58afe17adf6c1a81d (patch)
treeac4730d1acc0d39854e8c57771f06f864ded316e /src/game.cpp
parent9412eceeb4063f9b7540493449734299b5f3b3cd (diff)
downloadmana-7d5c6124e9c9cf447286eaa58afe17adf6c1a81d.tar.gz
mana-7d5c6124e9c9cf447286eaa58afe17adf6c1a81d.tar.bz2
mana-7d5c6124e9c9cf447286eaa58afe17adf6c1a81d.tar.xz
mana-7d5c6124e9c9cf447286eaa58afe17adf6c1a81d.zip
Obscure precise home directory name when making screenshots
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 0499263c..199c2638 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -342,6 +342,7 @@ bool saveScreenshot(SDL_Surface *screenshot)
static unsigned int screenshotCount = 0;
// Search for an unused screenshot name
+ std::stringstream filenameSuffix;
std::stringstream filename;
std::fstream testExists;
bool found = false;
@@ -349,12 +350,16 @@ bool saveScreenshot(SDL_Surface *screenshot)
do {
screenshotCount++;
filename.str("");
+ filenameSuffix.str("");
+ filename << PHYSFS_getUserDir();
#if (defined __USE_UNIX98 || defined __FreeBSD__)
- filename << PHYSFS_getUserDir() << ".tmw/";
+ filenameSuffix << ".tmw/";
#elif defined __APPLE__
- filename << PHYSFS_getUserDir() << "Desktop/";
+ filenameSuffix << "Desktop/";
#endif
- filename << "TMW_Screenshot_" << screenshotCount << ".png";
+ filenameSuffix << "TMW_Screenshot_" << screenshotCount << ".png";
+ filename << filenameSuffix.str();
+ std::cerr << "Trying `" << filename.str() << "' from `" << filenameSuffix.str() << "'\n";
testExists.open(filename.str().c_str(), std::ios::in);
found = !testExists.is_open();
testExists.close();
@@ -363,7 +368,7 @@ bool saveScreenshot(SDL_Surface *screenshot)
if (ImageWriter::writePNG(screenshot, filename.str()))
{
std::stringstream chatlogentry;
- chatlogentry << "Screenshot saved to " << filename.str().c_str();
+ chatlogentry << "Screenshot saved to ~/" << filenameSuffix.str().c_str();
chatWindow->chatLog(chatlogentry.str(), BY_SERVER);
return true;
}