Skip to content

Commit

Permalink
CriticalErrorDialog: Don't tell users to look for log files that don'…
Browse files Browse the repository at this point in the history
…t exist.
  • Loading branch information
dscharrer committed Apr 24, 2012
1 parent e244e40 commit a9a7476
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/io/log/CriticalLogger.cpp
Expand Up @@ -19,29 +19,35 @@

#include "io/log/CriticalLogger.h"

#include "platform/Dialog.h"
#include "platform/Platform.h"

#include "core/Config.h"
#include "core/Version.h"
#include "io/fs/Filesystem.h"
#include "platform/Dialog.h"
#include "platform/Platform.h"

namespace logger {

CriticalErrorDialog::~CriticalErrorDialog() {

if(!errorString.empty()) {
std::string fullText = errorString;
if(!config.paths.config.string().empty())
fullText += "\n\nYou might want to take a look at arx.log under \"" + config.paths.config.string() + "\" for more details.";

if(fs::exists(config.paths.user / "arx.log")) {
fullText += "\n\nYou might want to take a look at arx.log under \""
+ config.paths.user.string() + "\" for more details.";
}

dialog::showError(fullText, "Critical Error - " + version);
}
}

void CriticalErrorDialog::log(const Source & file, int line, Logger::LogLevel level, const std::string & str) {
ARX_UNUSED(file);
ARX_UNUSED(line);
void CriticalErrorDialog::log(const Source & file, int line, Logger::LogLevel level,
const std::string & str) {
ARX_UNUSED(file), ARX_UNUSED(line);

if(level == Logger::Critical && errorString.empty())
if(level == Logger::Critical && errorString.empty()) {
errorString = str;
}
}

} // namespace logger

0 comments on commit a9a7476

Please sign in to comment.