aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn Kaijser <martijn@xbmc.org>2018-12-16 10:17:51 +0100
committerGitHub <noreply@github.com>2018-12-16 10:17:51 +0100
commit7a64feebd00a5966720d7db65c85f253b1d6e1be (patch)
treeee130505e962e7a743ab0d968009c0736ae308aa
parent5c2ecda3176f1491f6875045583f6cd1c90c7914 (diff)
parent4dcbd48aa9d63d24bd934ae9c913be2d1b58ea3e (diff)
Merge pull request #15068 from lrusak/screenshot-fix
Screenshot: simplify logic and bail out if no folder is set
-rw-r--r--xbmc/utils/Screenshot.cpp56
1 files changed, 8 insertions, 48 deletions
diff --git a/xbmc/utils/Screenshot.cpp b/xbmc/utils/Screenshot.cpp
index 24580ed232..0616e24a18 100644
--- a/xbmc/utils/Screenshot.cpp
+++ b/xbmc/utils/Screenshot.cpp
@@ -234,33 +234,19 @@ void CScreenShot::TakeScreenshot(const std::string &filename, bool sync)
void CScreenShot::TakeScreenshot()
{
- static bool savingScreenshots = false;
- static std::vector<std::string> screenShots;
- bool promptUser = false;
- std::string strDir;
-
- // check to see if we have a screenshot folder yet
std::shared_ptr<CSettingPath> screenshotSetting = std::static_pointer_cast<CSettingPath>(CServiceBroker::GetSettingsComponent()->GetSettings()->GetSetting(CSettings::SETTING_DEBUG_SCREENSHOTPATH));
- if (screenshotSetting != NULL)
- {
- strDir = screenshotSetting->GetValue();
- if (strDir.empty())
- {
- if (CGUIControlButtonSetting::GetPath(screenshotSetting, &g_localizeStrings))
- strDir = screenshotSetting->GetValue();
- }
- }
+ if (!screenshotSetting)
+ return;
+ std::string strDir = screenshotSetting->GetValue();
if (strDir.empty())
{
- strDir = "special://temp/";
- if (!savingScreenshots)
- {
- promptUser = true;
- savingScreenshots = true;
- screenShots.clear();
- }
+ if (!CGUIControlButtonSetting::GetPath(screenshotSetting, &g_localizeStrings))
+ return;
+
+ strDir = screenshotSetting->GetValue();
}
+
URIUtils::RemoveSlashAtEnd(strDir);
if (!strDir.empty())
@@ -270,32 +256,6 @@ void CScreenShot::TakeScreenshot()
if (!file.empty())
{
TakeScreenshot(file, false);
- if (savingScreenshots)
- screenShots.push_back(file);
- if (promptUser)
- { // grab the real directory
- std::string newDir;
- if (screenshotSetting != NULL)
- {
- newDir = screenshotSetting->GetValue();
- if (newDir.empty())
- {
- if (CGUIControlButtonSetting::GetPath(screenshotSetting, &g_localizeStrings))
- newDir = screenshotSetting->GetValue();
- }
- }
-
- if (!newDir.empty())
- {
- for (unsigned int i = 0; i < screenShots.size(); i++)
- {
- std::string file = CUtil::GetNextFilename(URIUtils::AddFileToFolder(newDir, "screenshot%03d.png"), 999);
- CFile::Copy(screenShots[i], file);
- }
- screenShots.clear();
- }
- savingScreenshots = false;
- }
}
else
{