- if (!use_emergency) {
- // Now check if autosave file is newer.
- a += '#';
- a += OnlyFilename(s);
- a += '#';
- FileInfo fileInfoA(a);
- if (fileInfoA.exist() && fileInfo.exist()) {
- if (fileInfoA.getModificationTime()
- > fileInfo.getModificationTime()) {
- string const file = MakeDisplayPath(s, 20);
- string text = bformat(_("The backup of the document %1$s is newer.\n\n"
- "Load the backup instead?"), file);
- int const ret = Alert::prompt(_("Load backup?"),
- text, 0, 1, _("&Load backup"), _("Load &original"));
-
- if (ret == 0) {
- ts = a;
- // the file is not saved if we load the
- // autosave file.
- b->markDirty();
- } else {
- // Here, we should delete the autosave
- unlink(a);
- }
- }
+ // Now check if autosave file is newer.
+ string const a = OnlyPath(s) + '#' + OnlyFilename(s) + '#';
+ FileInfo fileA(a);
+
+ if (fileA.exist() && fileN.exist()
+ && fileA.getModificationTime() > fileN.getModificationTime())
+ {
+ string const file = MakeDisplayPath(s, 20);
+ string text = bformat(_("The backup of the document "
+ "%1$s is newer.\n\nLoad the "
+ "backup instead?"), file);
+ switch (Alert::prompt(_("Load backup?"), text, 0, 2,
+ _("&Load backup"), _("Load &original"),
+ _("&Cancel") ))
+ {
+ case 0:
+ // the file is not saved if we load the autosave file.
+ b->markDirty();
+ return b->readFile(a);
+ case 1:
+ // Here we delete the autosave
+ unlink(a);
+ break;
+ default:
+ return false;