summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorEder Bastos <bastos.eder@gmail.com>2015-06-23 23:08:10 -0400
committerEder Bastos <bastos.eder@gmail.com>2015-06-23 23:08:10 -0400
commit7935c1c57a264158bbc8e0bda97fedaa8cbba96a (patch)
treef062620a7f681e5ce3f24e102e2686ac702d5f7d /Source/Core
parent8ca620db7f9b653d88ae4ec1f096f146bd8e6208 (diff)
Android: Ensure that the target folder for screenshots exists before attempting to save.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Core.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp
index c5b57d85ad..c7a1ba9914 100644
--- a/Source/Core/Core/Core.cpp
+++ b/Source/Core/Core/Core.cpp
@@ -636,7 +636,7 @@ EState GetState()
return CORE_UNINITIALIZED;
}
-static std::string GenerateScreenshotName()
+static std::string GenerateScreenshotFolderPath()
{
const std::string& gameId = SConfig::GetInstance().GetUniqueID();
std::string path = File::GetUserPath(D_SCREENSHOTS_IDX) + gameId + DIR_SEP_CHR;
@@ -647,8 +647,15 @@ static std::string GenerateScreenshotName()
path = File::GetUserPath(D_SCREENSHOTS_IDX);
}
+ return path;
+}
+
+static std::string GenerateScreenshotName()
+{
+ std::string path = GenerateScreenshotFolderPath();
+
//append gameId, path only contains the folder here.
- path += gameId;
+ path += SConfig::GetInstance().GetUniqueID();
std::string name;
for (int i = 1; File::Exists(name = StringFromFormat("%s-%d.png", path.c_str(), i)); ++i)
@@ -671,15 +678,13 @@ void SaveScreenShot()
SetState(CORE_RUN);
}
-void SaveScreenShot(std::string name)
+void SaveScreenShot(const std::string name)
{
const bool bPaused = (GetState() == CORE_PAUSE);
SetState(CORE_PAUSE);
- const std::string& gameId = SConfig::GetInstance().GetUniqueID();
-
- std::string filePath = File::GetUserPath(D_SCREENSHOTS_IDX) + gameId + DIR_SEP_CHR + name + ".png";
+ std::string filePath = GenerateScreenshotFolderPath() + name + ".png";
g_video_backend->Video_Screenshot(filePath);