svoid restoreLatestBackupIfConceptsFileEmpty(S dbID, O... _) { bool doIt = boolPar doIt(_); File file = conceptsFile(dbID); if (fileExists(file) && fileSize(file) == 0) { print(file + " corrupted, trying to restore"); File backup = lastThat fileNotEmpty(sortByFileName(conceptBackupFiles(dbID))); if (backup == null) ret with print("No usable backup found :("); print(stringIf(doIt, "[would be] ") + "RESTORING: " + backup); if (doIt) { clearConceptsOf(dbID); copyFile(backup, file); print("DB RESTORED!"); } } }