Skip to content

Commit 85d71f6

Browse files
committed
add check for directory not existing
1 parent 7a4f691 commit 85d71f6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/code/Utils.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,11 @@ public static void DeleteDirectoryWithRestore(string dirPath)
15841584
/// </Summary>
15851585
public static void DeleteDirectory(string dirPath)
15861586
{
1587+
if (!Directory.Exists(dirPath))
1588+
{
1589+
throw new Exception($"Path '{dirPath}' that was attempting to be deleted does not exist.");
1590+
}
1591+
15871592
// Remove read only file attributes first
15881593
foreach (var dirFilePath in Directory.GetFiles(dirPath,"*",SearchOption.AllDirectories))
15891594
{

0 commit comments

Comments
 (0)