From 36debd03f5040f2501d21a5104da694e51281518 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Thu, 16 Jun 2016 23:46:11 +0200 Subject: [PATCH] Create screenshot directory if not exist when using Report Feedback --- UI/ReportScreen.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/UI/ReportScreen.cpp b/UI/ReportScreen.cpp index 72170e3bf..af58a0cb9 100644 --- a/UI/ReportScreen.cpp +++ b/UI/ReportScreen.cpp @@ -26,6 +26,7 @@ #include "Core/Reporting.h" #include "Core/Screenshot.h" #include "Core/System.h" +#include "Common/FileUtil.h" #include "Common/Log.h" using namespace UI; @@ -222,7 +223,11 @@ void ReportScreen::CreateViews() { reportingNotice_ = nullptr; } - screenshotFilename_ = GetSysDirectory(DIRECTORY_SCREENSHOT) + ".reporting.jpg"; + std::string path = GetSysDirectory(DIRECTORY_SCREENSHOT); + if (!File::Exists(path)) { + File::CreateDir(path); + } + screenshotFilename_ = path + ".reporting.jpg"; int shotWidth = 0, shotHeight = 0; if (TakeGameScreenshot(screenshotFilename_.c_str(), SCREENSHOT_JPG, SCREENSHOT_RENDER, &shotWidth, &shotHeight, 4)) { float scale = 340.0f * (1.0f / g_dpi_scale) * (1.0f / shotHeight); @@ -230,6 +235,7 @@ void ReportScreen::CreateViews() { screenshot_ = leftColumnItems->Add(new AsyncImageFileView(screenshotFilename_, IS_DEFAULT, nullptr, new LinearLayoutParams(shotWidth * scale, shotHeight * scale, Margins(12, 0)))); } else { includeScreenshot_ = false; + screenshot_ = nullptr; } leftColumnItems->Add(new CompatRatingChoice("Overall", &overall_))->SetEnabledPtr(&enableReporting_)->OnChoice.Handle(this, &ReportScreen::HandleChoice);