How should I do autosave backups?
Posted: Thu Jul 07, 2022 10:44 am
I have this piece of code in my autosave method. My thinking is that if something goes wrong during file write (power loss or crash), ES3.DeleteFile will never execute and I'll be left with a backup file that the player can recover.
Is this a reasonable usage or is there something I'm missing?
Is this a reasonable usage or is there something I'm missing?
Code: Select all
ES3AutoSaveMgr.Current.settings.path = "save.es3";
if (ES3.FileExists("save.es3")){
ES3.CreateBackup("save.es3");
}
ES3AutoSaveMgr.Current.Save();
ES3.DeleteFile("save.es3" + ".bac");