mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 13:49:53 -06:00
Android: Ensure that the target folder for screenshots exists before attempting to save.
This commit is contained in:
@ -636,7 +636,7 @@ EState GetState()
|
|||||||
return CORE_UNINITIALIZED;
|
return CORE_UNINITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string GenerateScreenshotName()
|
static std::string GenerateScreenshotFolderPath()
|
||||||
{
|
{
|
||||||
const std::string& gameId = SConfig::GetInstance().GetUniqueID();
|
const std::string& gameId = SConfig::GetInstance().GetUniqueID();
|
||||||
std::string path = File::GetUserPath(D_SCREENSHOTS_IDX) + gameId + DIR_SEP_CHR;
|
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);
|
path = File::GetUserPath(D_SCREENSHOTS_IDX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string GenerateScreenshotName()
|
||||||
|
{
|
||||||
|
std::string path = GenerateScreenshotFolderPath();
|
||||||
|
|
||||||
//append gameId, path only contains the folder here.
|
//append gameId, path only contains the folder here.
|
||||||
path += gameId;
|
path += SConfig::GetInstance().GetUniqueID();
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
for (int i = 1; File::Exists(name = StringFromFormat("%s-%d.png", path.c_str(), i)); ++i)
|
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);
|
SetState(CORE_RUN);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveScreenShot(std::string name)
|
void SaveScreenShot(const std::string name)
|
||||||
{
|
{
|
||||||
const bool bPaused = (GetState() == CORE_PAUSE);
|
const bool bPaused = (GetState() == CORE_PAUSE);
|
||||||
|
|
||||||
SetState(CORE_PAUSE);
|
SetState(CORE_PAUSE);
|
||||||
|
|
||||||
const std::string& gameId = SConfig::GetInstance().GetUniqueID();
|
std::string filePath = GenerateScreenshotFolderPath() + name + ".png";
|
||||||
|
|
||||||
std::string filePath = File::GetUserPath(D_SCREENSHOTS_IDX) + gameId + DIR_SEP_CHR + name + ".png";
|
|
||||||
|
|
||||||
g_video_backend->Video_Screenshot(filePath);
|
g_video_backend->Video_Screenshot(filePath);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user