mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #261 from wabbajack-tools/fix-missing-app-data-folder
Check if the directory exists first before saving data to it
This commit is contained in:
commit
45a08b4005
@ -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/";
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user