mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-15 06:13:48 +00:00
Improved the save operation of settings by using a temporary file (#237)
This commit is contained in:
1 parent
8cbef49d89
commit
2131bf1817
2 files changed
+4
-1
No files matched your search
@@ -118,8 +118,10 @@ public sealed class SettingsManager(ILogger<SettingsManager> logger)
|
||||
}
|
||||
|
||||
var settingsJson = JsonSerializer.Serialize(this.ConfigurationData, JSON_OPTIONS);
|
||||
await File.WriteAllTextAsync(settingsPath, settingsJson);
|
||||
var tempFile = Path.GetTempFileName();
|
||||
await File.WriteAllTextAsync(tempFile, settingsJson);
|
||||
|
||||
File.Move(tempFile, settingsPath, true);
|
||||
this.logger.LogInformation("Stored the settings to the file system.");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user