Page 2 of 2

Re: I cant delete the file on game

Posted: Fri Aug 11, 2023 12:23 pm
by Tanoshimi
Any chance we can get a ClearSaves() function that might delete the cache and the file? I was surprised when I deleted the SaveFile.es3 from my directory and it still loaded the data. Now I get why, but that's kinda interesting behavior.

Re: I cant delete the file on game

Posted: Fri Aug 11, 2023 1:25 pm
by Joel
Hi there,

This script will add ES3Tools.DeleteFileFromAllLocations() and ES3Tools.DeleteFileFromAllLocations(string filePath) methods to your project.

Code: Select all

public static class ES3Tools
{
    // Deletes the default save file from disk and cache.
    public static void DeleteFileFromAllLocations()
    {
        ES3.DeleteFile(new ES3Settings(ES3.Location.File));
        ES3.DeleteFile(new ES3Settings(ES3.Location.Cache));
    }

    // Delets the file with the given name or path from disk and cache.
    public static void DeleteFileFromAllLocations(string filePath)
    {
        ES3.DeleteFile(filePath, new ES3Settings(ES3.Location.File));
        ES3.DeleteFile(filePath, new ES3Settings(ES3.Location.Cache));
    }
}
All the best,
Joel