-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
47 lines (40 loc) · 1.27 KB
/
Copy pathProgram.cs
File metadata and controls
47 lines (40 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System.Diagnostics;
using Avalonia;
using Velopack;
namespace Aniki;
internal sealed class Program
{
[STAThread]
public static void Main(string[] args)
{
VelopackApp builder = VelopackApp.Build();
if (OperatingSystem.IsWindows())
builder = builder.OnAfterUpdateFastCallback(_ => ClearCachesAfterUpdate());
builder.Run();
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
private static void ClearCachesAfterUpdate()
{
try
{
string root = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"Aniki");
foreach (string name in new[] { "cache", "ImageCache" })
{
string path = Path.Combine(root, name);
if (Directory.Exists(path))
Directory.Delete(path, recursive: true);
}
Debug.WriteLine("Cleared caches after update.");
}
catch (Exception ex)
{
Debug.WriteLine($"Post-update cache clear failed: {ex.Message}");
}
}
}