Skip to content

Commit

Permalink
配置文件所在文件夹不存在时,也能写入配置
Browse files Browse the repository at this point in the history
  • Loading branch information
walterlv committed Feb 29, 2024
1 parent 5a357e3 commit 3c91102
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ private void WriteAllText(string text)
DoIOActionWithRetry(i =>
{
CT.Log($"正在写入文件(i):{text.Replace("\r\n", "\\n").Replace("\n", "\\n")}", _file.Name, "Sync");
if (!Directory.Exists(_file.Directory.FullName))
{
_file.Directory.Create();
}
using var fileStream = new FileStream(
_file.FullName, FileMode.OpenOrCreate,
FileAccess.Write, FileShare.None,
Expand Down

0 comments on commit 3c91102

Please sign in to comment.