From e783efa7959a835bc17dd0208c472490bf0d2aba Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 4 Aug 2011 13:51:24 +0530 Subject: [PATCH] [xbuild] RemoveDir - remove only if the dir exists. Fixes bug #710234. --- .../Microsoft.Build.Tasks/RemoveDir.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/RemoveDir.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/RemoveDir.cs index d8783035251..32505c9a424 100644 --- a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/RemoveDir.cs +++ b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/RemoveDir.cs @@ -52,11 +52,11 @@ namespace Microsoft.Build.Tasks { foreach (ITaskItem directory in directories) { try { - Directory.Delete (directory.GetMetadata ("FullPath"), true); - temporaryRemovedDirectories.Add (directory); - } - catch (DirectoryNotFoundException ex) { - Log.LogErrorFromException (ex); + string fullpath = directory.GetMetadata ("FullPath"); + if (Directory.Exists (fullpath)) { + Directory.Delete (fullpath, true); + temporaryRemovedDirectories.Add (directory); + } } catch (PathTooLongException ex) { Log.LogErrorFromException (ex); -- 2.25.1