-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathArtifactCleaner.cs
More file actions
34 lines (31 loc) · 1.07 KB
/
ArtifactCleaner.cs
File metadata and controls
34 lines (31 loc) · 1.07 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
using System;
using System.IO;
namespace Compiler
{
public class ArtifactCleaner
{
private static readonly string[] FilesToDelete = new string[] { "Serilog.*.dll", "Serilog.dll", "Microsoft*.dll", "CounterStrikeSharp.API.dll", "McMaster.NETCore.Plugins.dll", "Scrutor.dll", "System.Diagnostics.EventLog.dll" };
public static void CleanupArtifacts(string folderPath)
{
try
{
foreach (string filePattern in FilesToDelete)
{
foreach (string file in Directory.GetFiles(folderPath, filePattern))
{
File.Delete(file);
}
}
string runtimesDir = Path.Combine(folderPath, "runtimes");
if (Directory.Exists(runtimesDir))
{
Directory.Delete(runtimesDir, true);
}
}
catch (Exception ex)
{
Console.WriteLine($"Error cleaning up artifacts: {ex.Message}");
}
}
}
}