summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorFate <fate-tmw@googlemail.com>2008-12-10 14:26:53 -0700
committerIra Rice <irarice@gmail.com>2008-12-10 16:40:14 -0700
commitae7cd9ca453aee25ccf1f4eb277ab77144910da5 (patch)
tree81d8132c90f5589d11e1adde7e451c8f906f5dcf /src/game.cpp
parente2a74899c5ab96a4a1dc848ca8e48df9b126a70a (diff)
downloadmana-client-ae7cd9ca453aee25ccf1f4eb277ab77144910da5.tar.gz
mana-client-ae7cd9ca453aee25ccf1f4eb277ab77144910da5.tar.bz2
mana-client-ae7cd9ca453aee25ccf1f4eb277ab77144910da5.tar.xz
mana-client-ae7cd9ca453aee25ccf1f4eb277ab77144910da5.zip
Obscure precise home directory name when making screenshots
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 91a58d43..0957dbe8 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -347,28 +347,33 @@ 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;
do {
- screenshotCount++;
- filename.str("");
+ screenshotCount++;
+ filename.str("");
+ filenameSuffix.str("");
+ filename << PHYSFS_getUserDir();
#if (defined __USE_UNIX98 || defined __FreeBSD__)
- filename << PHYSFS_getUserDir() << ".aethyra/";
+ filenameSuffix << ".aethyra/";
#elif defined __APPLE__
- filename << PHYSFS_getUserDir() << "Desktop/";
+ filenameSuffix << "Desktop/";
#endif
- filename << "Ae_Screenshot_" << screenshotCount << ".png";
- testExists.open(filename.str().c_str(), std::ios::in);
- found = !testExists.is_open();
- testExists.close();
+ filenameSuffix << "Ae_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();
} while (!found);
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;
}