diff --git a/ArchiSteamFarm/BotDatabase.cs b/ArchiSteamFarm/BotDatabase.cs index 66ac9e341..463b5fdfe 100644 --- a/ArchiSteamFarm/BotDatabase.cs +++ b/ArchiSteamFarm/BotDatabase.cs @@ -251,17 +251,16 @@ namespace ArchiSteamFarm { await FileSemaphore.WaitAsync().ConfigureAwait(false); - if (ReadOnly) { - return; - } - try { - await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false); + if (ReadOnly) { + return; + } if (File.Exists(FilePath)) { + await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false); File.Replace(newFilePath, FilePath, null); } else { - File.Move(newFilePath, FilePath); + await File.WriteAllTextAsync(FilePath, json).ConfigureAwait(false); } } catch (Exception e) { ASF.ArchiLogger.LogGenericException(e); diff --git a/ArchiSteamFarm/GlobalDatabase.cs b/ArchiSteamFarm/GlobalDatabase.cs index 4374aaa6d..083d80a52 100644 --- a/ArchiSteamFarm/GlobalDatabase.cs +++ b/ArchiSteamFarm/GlobalDatabase.cs @@ -166,12 +166,11 @@ namespace ArchiSteamFarm { await FileSemaphore.WaitAsync().ConfigureAwait(false); try { - await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false); - if (File.Exists(FilePath)) { + await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false); File.Replace(newFilePath, FilePath, null); } else { - File.Move(newFilePath, FilePath); + await File.WriteAllTextAsync(FilePath, json).ConfigureAwait(false); } } catch (Exception e) { ASF.ArchiLogger.LogGenericException(e);