How should I do autosave backups?

Discussion and help for Easy Save 3
Post Reply
newjohnny
Posts: 12
Joined: Thu Jan 31, 2019 1:00 am

How should I do autosave backups?

Post 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");
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: How should I do autosave backups?

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply