diff options
author | Fate <fate-tmw@googlemail.com> | 2008-12-10 14:26:53 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-12-10 16:40:14 -0700 |
commit | ae7cd9ca453aee25ccf1f4eb277ab77144910da5 (patch) | |
tree | 81d8132c90f5589d11e1adde7e451c8f906f5dcf /src/game.cpp | |
parent | e2a74899c5ab96a4a1dc848ca8e48df9b126a70a (diff) | |
download | mana-ae7cd9ca453aee25ccf1f4eb277ab77144910da5.tar.gz mana-ae7cd9ca453aee25ccf1f4eb277ab77144910da5.tar.bz2 mana-ae7cd9ca453aee25ccf1f4eb277ab77144910da5.tar.xz mana-ae7cd9ca453aee25ccf1f4eb277ab77144910da5.zip |
Obscure precise home directory name when making screenshots
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 23 |
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; } |