Move settings and other cache data to the local user folder.

This commit is contained in:
Timothy Baldridge 2020-02-07 17:56:22 -07:00
parent 348abab902
commit e4d4a890f1
4 changed files with 9 additions and 7 deletions

View File

@ -100,5 +100,7 @@ namespace Wabbajack.Common
public static int WabbajackCachePort = 80;
public static int MaxHTTPRetries = 4;
public const string MO2ModFolderName = "mods";
public static string PatchCacheFolder => Path.Combine(LocalAppDataPath, "patch_cache");
}
}

View File

@ -824,9 +824,9 @@ namespace Wabbajack.Common
{
var dataA = a.xxHash().FromBase64().ToHex();
var dataB = b.xxHash().FromBase64().ToHex();
var cacheFile = Path.Combine("patch_cache", $"{dataA}_{dataB}.patch");
if (!Directory.Exists("patch_cache"))
Directory.CreateDirectory("patch_cache");
var cacheFile = Path.Combine(Consts.PatchCacheFolder, $"{dataA}_{dataB}.patch");
if (!Directory.Exists(Consts.PatchCacheFolder))
Directory.CreateDirectory(Consts.PatchCacheFolder);
while (true)
{
@ -837,7 +837,7 @@ namespace Wabbajack.Common
}
else
{
var tmpName = Path.Combine("patch_cache", Guid.NewGuid() + ".tmp");
var tmpName = Path.Combine(Consts.PatchCacheFolder, Guid.NewGuid() + ".tmp");
await using (var f = File.Open(tmpName, System.IO.FileMode.Create))
{
@ -867,7 +867,7 @@ namespace Wabbajack.Common
public static bool TryGetPatch(string foundHash, string fileHash, out byte[] ePatch)
{
var patchName = Path.Combine("patch_cache",
var patchName = Path.Combine(Consts.PatchCacheFolder,
$"{foundHash.FromBase64().ToHex()}_{fileHash.FromBase64().ToHex()}.patch");
if (File.Exists(patchName))
{

View File

@ -22,7 +22,7 @@ namespace Wabbajack.Lib
public bool ReadmeIsWebsite;
public string WabbajackVersion;
protected static string _vfsCacheName = "vfs_compile_cache.bin";
protected static string _vfsCacheName => Path.Combine(Consts.LocalAppDataPath, "vfs_compile_cache.bin");
/// <summary>
/// A stream of tuples of ("Update Title", 0.25) which represent the name of the current task
/// and the current progress.

View File

@ -88,7 +88,7 @@ namespace Wabbajack.Lib.LibCefHelpers
if (Inited) return;
Inited = true;
CefSettings settings = new CefSettings();
settings.CachePath = Path.Combine(Directory.GetCurrentDirectory() + @"\CEF");
settings.CachePath = Path.Combine(Consts.LocalAppDataPath + @"\CEF");
Cef.Initialize(settings);
}