fixed file extension

This commit is contained in:
FreezeDriedMangoes 2023-01-31 15:08:03 -05:00
parent c7f12c967b
commit b3accf459d

View File

@ -25,12 +25,19 @@ namespace NewHorizons.Utility
#region Cache
public void LoadCache()
{
if (RelativePath != null) Cache = new Cache(RelativePath+".nhcache");
if (RelativePath == null)
{
Logger.LogWarning("Cannot load cache! RelativePath is null!");
return;
}
var pathWithoutExtension = RelativePath.Substring(0, RelativePath.LastIndexOf('.'));
Cache = new Cache(pathWithoutExtension+".nhcache");
}
public void UnloadCache(bool writeBeforeUnload=false)
{
if (writeBeforeUnload) Cache.WriteToFile();
if (writeBeforeUnload) Cache?.WriteToFile();
Cache = null; // garbage collection will take care of it
}