mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 15:14:41 +00:00
Misc
This commit is contained in:
parent
6916d2c070
commit
cc1f99d5d4
2 changed files with 8 additions and 4 deletions
|
@ -256,11 +256,13 @@ namespace ArchiSteamFarm {
|
|||
return;
|
||||
}
|
||||
|
||||
// We always want to write entire content to temporary file first, in order to never load corrupted data, also when target file doesn't exist
|
||||
await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
|
||||
|
||||
if (File.Exists(FilePath)) {
|
||||
await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
|
||||
File.Replace(newFilePath, FilePath, null);
|
||||
} else {
|
||||
await File.WriteAllTextAsync(FilePath, json).ConfigureAwait(false);
|
||||
File.Move(newFilePath, FilePath);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ASF.ArchiLogger.LogGenericException(e);
|
||||
|
|
|
@ -166,11 +166,13 @@ namespace ArchiSteamFarm {
|
|||
await FileSemaphore.WaitAsync().ConfigureAwait(false);
|
||||
|
||||
try {
|
||||
// We always want to write entire content to temporary file first, in order to never load corrupted data, also when target file doesn't exist
|
||||
await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
|
||||
|
||||
if (File.Exists(FilePath)) {
|
||||
await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
|
||||
File.Replace(newFilePath, FilePath, null);
|
||||
} else {
|
||||
await File.WriteAllTextAsync(FilePath, json).ConfigureAwait(false);
|
||||
File.Move(newFilePath, FilePath);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ASF.ArchiLogger.LogGenericException(e);
|
||||
|
|
Loading…
Reference in a new issue