Thanks .NET Framework

This commit is contained in:
JustArchi
2020-06-13 15:06:07 +02:00
parent 88b4856fe1
commit 70bb1e865a
2 changed files with 16 additions and 2 deletions

View File

@@ -832,7 +832,7 @@ namespace ArchiSteamFarm {
Directory.CreateDirectory(targetBackupDirectory);
string targetBackupFile = Path.Combine(targetBackupDirectory, fileName);
File.Move(file, targetBackupFile, true);
RuntimeCompatibility.File.Move(file, targetBackupFile, true);
}
// We can now get rid of directories that are empty
@@ -849,7 +849,7 @@ namespace ArchiSteamFarm {
if (File.Exists(file)) {
// This is possible only with files that we decided to leave in place during our backup function
string targetBackupFile = file + ".bak";
File.Move(file, targetBackupFile, true);
RuntimeCompatibility.File.Move(file, targetBackupFile, true);
}
// Check if this file requires its own folder

View File

@@ -64,6 +64,20 @@ namespace ArchiSteamFarm {
await System.IO.File.AppendAllTextAsync(path, contents).ConfigureAwait(false);
#endif
#pragma warning disable IDE0022
public static void Move([NotNull] string sourceFileName, [NotNull] string destFileName, bool overwrite) {
#if NETFRAMEWORK
if (System.IO.File.Exists(destFileName)) {
System.IO.File.Delete(destFileName);
}
System.IO.File.Move(sourceFileName, destFileName);
#else
System.IO.File.Move(sourceFileName, destFileName, overwrite);
#endif
}
#pragma warning restore IDE0022
[ItemNotNull]
public static async Task<byte[]> ReadAllBytesAsync([NotNull] string path) =>
#if NETFRAMEWORK