diff --git a/Wabbajack.Common/Consts.cs b/Wabbajack.Common/Consts.cs index 7b73acf5..c839b5f0 100644 --- a/Wabbajack.Common/Consts.cs +++ b/Wabbajack.Common/Consts.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.Reflection; using System.Runtime.InteropServices; +using Alphaleonis.Win32.Filesystem; +using Syroot.Windows.IO; namespace Wabbajack.Common { @@ -84,6 +86,7 @@ namespace Wabbajack.Common } public static string HashFileExtension => ".xxHash"; + public static string LocalAppDataPath => Path.Combine(KnownFolders.LocalAppData.Path, "Wabbajack"); public static string WabbajackCacheLocation = "http://build.wabbajack.org/nexus_api_cache/"; } diff --git a/Wabbajack.Common/Utils.cs b/Wabbajack.Common/Utils.cs index 4a227f8c..275243d1 100644 --- a/Wabbajack.Common/Utils.cs +++ b/Wabbajack.Common/Utils.cs @@ -913,7 +913,11 @@ namespace Wabbajack.Common { var bytes = Encoding.UTF8.GetBytes(data.ToJSON()); var encoded = ProtectedData.Protect(bytes, Encoding.UTF8.GetBytes(key), DataProtectionScope.LocalMachine); - var path = Path.Combine(KnownFolders.LocalAppData.Path, "Wabbajack", key); + + if (!Directory.Exists(Consts.LocalAppDataPath)) + Directory.CreateDirectory(Consts.LocalAppDataPath); + + var path = Path.Combine(Consts.LocalAppDataPath, key); File.WriteAllBytes(path, encoded); }