Page 1 of 1

How should I do autosave backups?

Posted: Thu Jul 07, 2022 10:44 am
by newjohnny
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?

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");

Re: How should I do autosave backups?

Posted: Thu Jul 07, 2022 11:46 am
by Joel
Hi there,

This is correct usage, though you don't need the ES3.FileExists call as ES3.CreateBackup does this for you.

All the best,
Joel