Adjust functions so mirror .NET API better
MODIFY
WalletWasabi/Helpers/IoHelpers.cs
WalletWasabi/Helpers/IoHelpers.cs
@@ -73,14 +73,28 @@ namespace System.IO
public static void SafeWriteAllText(string path, string content)
{
var newPath = path + NewExtension;
- File.WriteAllText(newPath, content, Encoding.UTF8);
+ File.WriteAllText(newPath, content);
+ SafeMove(newPath, path);
+ }
+
+ public static void SafeWriteAllText(string path, string content, Encoding encoding)
+ {
+ var newPath = path + NewExtension;
+ File.WriteAllText(newPath, content, encoding);
SafeMove(newPath, path);
}
public static async Task SafeWriteAllTextAsync(string path, string content)
{
var newPath = path + NewExtension;
- await File.WriteAllTextAsync(newPath, content, Encoding.UTF8);
+ await File.WriteAllTextAsync(newPath, content);
+ SafeMove(newPath, path);
+ }
+
+ public static async Task SafeWriteAllTextAsync(string path, string content, Encoding encoding)
+ {
+ var newPath = path + NewExtension;
+ await File.WriteAllTextAsync(newPath, content, encoding);
SafeMove(newPath, path);
}

MODIFY
WalletWasabi/KeyManagement/KeyManager.cs
WalletWasabi/KeyManagement/KeyManager.cs
@@ -126,7 +126,7 @@ namespace WalletWasabi.KeyManagement
lock (ToFileLock)
{
string jsonString = JsonConvert.SerializeObject(this, Formatting.Indented);
- IoHelpers.SafeWriteAllText(filePath, jsonString);
+ IoHelpers.SafeWriteAllText(filePath, jsonString, Encoding.UTF8);
}
}

Adjust functions so mirror .NET API better