Add a directory-delete helper.
This seems to be needed on Windows to delete temporary staging files correctly.
This commit is contained in:
parent
ffedcb315f
commit
23e024c463
4 changed files with 21 additions and 16 deletions
|
@ -85,5 +85,20 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
b[x] = b[y];
|
||||
b[y] = t;
|
||||
}
|
||||
|
||||
public static void DeleteDirectory(string path)
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
|
||||
foreach (string file in files)
|
||||
{
|
||||
File.SetAttributes(file, FileAttributes.Normal);
|
||||
File.Delete(file);
|
||||
}
|
||||
|
||||
Directory.Delete(path, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue