public override bool Execute ()
{
+ if (directories.Length == 0)
+ return true;
+
List <ITaskItem> temporaryRemovedDirectories = new List <ITaskItem> ();
foreach (ITaskItem directory in directories) {
try {
- Directory.Delete (directory.GetMetadata ("FullPath"), true);
- temporaryRemovedDirectories.Add (directory);
- }
- catch (DirectoryNotFoundException ex) {
- Log.LogErrorFromException (ex);
- }
- catch (PathTooLongException ex) {
- Log.LogErrorFromException (ex);
- }
- catch (ArgumentNullException ex) {
- Log.LogErrorFromException (ex);
- }
- catch (ArgumentException ex) {
- Log.LogErrorFromException (ex);
- }
- catch (IOException ex) {
- Log.LogErrorFromException (ex);
- }
- catch (SecurityException ex) {
- Log.LogErrorFromException (ex);
+ string fullpath = directory.GetMetadata ("FullPath");
+ if (Directory.Exists (fullpath)) {
+ Directory.Delete (fullpath, true);
+ temporaryRemovedDirectories.Add (directory);
+ }
}
catch (Exception ex) {
Log.LogErrorFromException (ex);
}
}
-#endif
\ No newline at end of file
+#endif