Skip to content

Commit

Permalink
Create screenshot directory if not exist when using Report Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaMoo committed Jun 18, 2016
1 parent 239d6d3 commit 36debd0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion UI/ReportScreen.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -222,14 +223,19 @@ 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);
leftColumnItems->Add(new CheckBox(&includeScreenshot_, rp->T("FeedbackIncludeScreen", "Include a screenshot")))->SetEnabledPtr(&enableReporting_);
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);
Expand Down

0 comments on commit 36debd0

Please sign in to comment.