ES3.RestoreBackup
Description
Restores a backup of a file created using ES3.CreateBackup.
A backup is created by copying the file and giving it a .bak extension.
If a backup already exists it will be overwritten, so you will need to ensure that the old backup will not be required before calling this method.
Parameters
filePath | [Optional] The relative or absolute path of the file we want to restore the backup of. |
settings |
[Optional] The settings we want to use to override the default settings. |
Returns
True if a backup was restored, or False if no backup could be found.
Examples
C#
1 2 3 4 5 6 7 8 9 10 11 |
try { myInt = ES3.Load<int>("myInt", "myFile.es3"); } catch { if(ES3.RestoreBackup("myFile.es3")) Debug.Log("Backup restored."); else Debug.Log("Backup could not be restored as no backup exists."); } |
JS
1 2 3 4 5 6 7 8 9 10 11 |
try { myInt = ES3.Load.<int>("myInt", "myFile.es3"); } catch { if(ES3.RestoreBackup("myFile.es3")) Debug.Log("Backup restored."); else Debug.Log("Backup could not be restored as no backup exists."); } |