Skip to content

Commit

Permalink
Fix up more formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Feb 23, 2024
1 parent 55a78b8 commit 64aaa35
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Xamarin.Android.Build.Tasks/Tasks/RemoveUnknownFiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,28 @@ public override bool RunTask ()
continue;
}
var files = System.IO.Directory.GetFiles (absDir, "*", SearchOption.AllDirectories);
foreach (string f in files)
foreach (string f in files) {
if (!knownFiles.Contains (f)) {
Log.LogDebugMessage ("Deleting File {0}", f);
var item = new TaskItem (f.Replace (absDir, root + Path.DirectorySeparatorChar));
removedFiles.Add (item);
Microsoft.Android.Build.Tasks.Files.SetWriteable (f);
File.Delete (f);
}
}

if (RemoveDirectories) {
var knownDirs = new HashSet<string> (knownFiles.Select (d => Path.GetDirectoryName (d)));
var dirs = System.IO.Directory.GetDirectories (absDir, "*", SearchOption.AllDirectories);

foreach (string d in dirs.OrderByDescending (s => s.Length))
foreach (string d in dirs.OrderByDescending (s => s.Length)) {
if (!knownDirs.Contains (d) && IsDirectoryEmpty (d)) {
Log.LogDebugMessage ("Deleting Directory {0}", d);
removedDirectories.Add (new TaskItem(d));
Microsoft.Android.Build.Tasks.Files.SetDirectoryWriteable (d);
System.IO.Directory.Delete (d);
}
}
}
}

Expand Down

0 comments on commit 64aaa35

Please sign in to comment.