mirror of https://github.com/odrling/Aegisub
Turn broken hotkeys.dat file into a non-fatal error. If the file is broken (usually meaning exists but empty) the existing file will now be copied to hotkeys.bak and the defaults restored and saved as hotkeys.dat.
Originally committed to SVN as r2982.
This commit is contained in:
parent
c8768d8043
commit
a1a4d797e7
|
@ -274,7 +274,15 @@ void HotkeyManager::Load() {
|
|||
using namespace std;
|
||||
TextFileReader file(filename);
|
||||
wxString header = file.ReadLineFromFile();
|
||||
if (header != _T("[Hotkeys]")) throw _T("Invalid hotkeys file");
|
||||
if (header != _T("[Hotkeys]")) {
|
||||
wxFileName backupfn(filename);
|
||||
backupfn.SetFullName(_T("hotkeys.bak"));
|
||||
wxCopyFile(filename, backupfn.GetFullPath());
|
||||
modified = true;
|
||||
Save();
|
||||
wxLogWarning(_T("Hotkeys file corrupted, defaults restored.\nA backup of the corrupted file was made."));
|
||||
return;
|
||||
}
|
||||
|
||||
// Get variables
|
||||
wxString curLine;
|
||||
|
|
Loading…
Reference in New Issue