diff --git a/src/backend/generators.h b/src/backend/generators.h
index 870456f3..9f4020cc 100644
--- a/src/backend/generators.h
+++ b/src/backend/generators.h
@@ -43,6 +43,34 @@ namespace loot {
//LOOT Report generation stuff.
+ inline std::string GetOldReportDetails(boost::filesystem::path& filepath) {
+ if (boost::filesystem::exists(filepath)) {
+ BOOST_LOG_TRIVIAL(debug) << "Reading the previous report's details section.";
+ //Read the whole file in.
+ std::string contents;
+ loot::ifstream in(filepath, ios::binary);
+ in.seekg(0, std::ios::end);
+ contents.resize(in.tellg());
+ in.seekg(0, std::ios::beg);
+ in.read(&contents[0], contents.size());
+ in.close();
+
+ //Slim down to only the details section.
+ size_t pos1 = contents.find("
", pos1);
+ if (pos1 != string::npos) {
+ size_t pos2 = contents.find("
", pos1);
+ if (pos2 != string::npos) {
+ pos2 -= 6; // "
"
+ return contents.substr(pos1, pos2 - pos1);
+ }
+ }
+ }
+ }
+ return "";
+ }
+
struct xml_string_writer: pugi::xml_writer {
std::string result;
@@ -541,7 +569,6 @@ namespace loot {
inline void GenerateReport(const boost::filesystem::path& file,
std::list
& messages,
const std::list& plugins,
- const std::string& oldDetails,
const std::string& masterlistVersion,
const bool masterlistUpdateEnabled) {
@@ -554,7 +581,9 @@ namespace loot {
AppendNav(body);
- int messageNo=0;
+ int messageNo = 0;
+ //Read the details section of the previous report, if it exists.
+ string oldDetails = GetOldReportDetails(file);
AppendMain(body, oldDetails, masterlistVersion, masterlistUpdateEnabled, messages, plugins, messageNo);
AppendFilters(body, messageNo, plugins.size());
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
index 18b58e55..9d39d904 100644
--- a/src/gui/main.cpp
+++ b/src/gui/main.cpp
@@ -61,8 +61,6 @@
#include
#include
-#define BOOST_THREAD_VERSION 4
-
wxIMPLEMENT_APP(LOOT);
using namespace loot;
@@ -913,38 +911,11 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
// Build & Display Report
///////////////////////////////////////////////////////
- //Read the details section of the previous report, if it exists.
- string oldDetails;
- if (fs::exists(_game.ReportPath().string())) {
- BOOST_LOG_TRIVIAL(debug) << "Reading the previous report's details section.";
- //Read the whole file in.
- loot::ifstream in(_game.ReportPath(), ios::binary);
- in.seekg(0, std::ios::end);
- oldDetails.resize(in.tellg());
- in.seekg(0, std::ios::beg);
- in.read(&oldDetails[0], oldDetails.size());
- in.close();
-
- //Slim down to only the details section.
- size_t pos1 = oldDetails.find("", pos1);
- if (pos1 != string::npos) {
- size_t pos2 = oldDetails.find("
", pos1);
- if (pos2 != string::npos) {
- pos2 -= 6; // "
"
- oldDetails = oldDetails.substr(pos1, pos2 - pos1);
- }
- }
- }
- }
-
BOOST_LOG_TRIVIAL(debug) << "Generating report...";
try {
GenerateReport(_game.ReportPath(),
messages,
plugins,
- oldDetails,
revision,
doUpdate);
} catch (loot::error& e) {