From 5a9249f2278ef1c2113319207ee0ae137a4bd4b6 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Fri, 11 Jan 2008 04:04:28 +0000 Subject: [PATCH] Fixed #617 (auto-solve corrupt config.dat) Originally committed to SVN as r1684. --- aegisub/options.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/aegisub/options.cpp b/aegisub/options.cpp index 7266dad3a..576544e24 100644 --- a/aegisub/options.cpp +++ b/aegisub/options.cpp @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include "options.h" #include "text_file_reader.h" #include "text_file_writer.h" @@ -412,7 +414,12 @@ void OptionsManager::Load() { // Read header TextFileReader file(filename); wxString header = file.ReadLineFromFile(); - if (header != _T("[Config]")) throw _T("Configuration file is invalid"); + if (header != _T("[Config]")) { + wxMessageBox(_("Configuration file is either invalid or corrupt. The current file will be backed up and replaced with a default file."),_("Error"),wxCENTRE|wxICON_WARNING); + wxRenameFile(filename,filename + wxString::Format(_T(".%i.backup"),wxGetUTCTime())); + modified = true; + return; + } // Get variables std::map::iterator cur;