You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
616 B
23 lines
616 B
1 year ago
|
namespace StabilityMatrix.Tests;
|
||
|
|
||
|
public static class TempFiles
|
||
|
{
|
||
|
// Deletes directory while handling junction folders
|
||
|
public static void DeleteDirectory(string directory)
|
||
|
{
|
||
|
// Enumerate to delete any directory links
|
||
|
foreach (var item in Directory.EnumerateDirectories(directory))
|
||
|
{
|
||
|
var info = new DirectoryInfo(item);
|
||
|
if (info.Exists && info.Attributes.HasFlag(FileAttributes.ReparsePoint))
|
||
|
{
|
||
|
info.Delete();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
DeleteDirectory(item);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|