Skip to content

Commit 3d96842

Browse files
committed
refactor: stores crash logs into crashes sub-folder
Signed-off-by: leo <longshuang@msn.cn>
1 parent 5b06432 commit 3d96842

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/App.axaml.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,12 @@ public static void LogException(Exception ex)
8383
if (ex == null)
8484
return;
8585

86+
var crashDir = Path.Combine(Native.OS.DataDir, "crashes");
87+
if (!Directory.Exists(crashDir))
88+
Directory.CreateDirectory(crashDir);
89+
8690
var time = DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss");
87-
var file = Path.Combine(Native.OS.DataDir, $"crash_{time}.log");
91+
var file = Path.Combine(crashDir, $"{time}.log");
8892
using var writer = new StreamWriter(file);
8993
writer.WriteLine($"Crash::: {ex.GetType().FullName}: {ex.Message}");
9094
writer.WriteLine();

0 commit comments

Comments
 (0)