Skip to content

Commit

Permalink
Merge pull request #697 from mono/develop
Browse files Browse the repository at this point in the history
Fix bug [966887] : FrameworksIndex files not cleaned up (#696)
  • Loading branch information
huangmin-ms authored May 27, 2024
2 parents 233b49a + bb0706f commit e74bcbd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mdoc/Consts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Mono.Documentation
{
public static class Consts
{
public static string MonoVersion = "5.9.3.1";
public static string MonoVersion = "5.9.3.2";
public const string DocId = "DocId";
public const string CppCli = "C++ CLI";
public const string CppCx = "C++ CX";
Expand Down
22 changes: 18 additions & 4 deletions mdoc/Mono.Documentation/Updater/Frameworks/FrameworkIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ public void WriteToDisk (string path)
if (string.IsNullOrWhiteSpace (this.path))
return;

string outputPath = Path.Combine (path, Consts.FrameworksIndex);
string outputPath = Path.Combine (path, Consts.FrameworksIndex);

if (!Directory.Exists (outputPath))
Directory.CreateDirectory (outputPath);

foreach (var fx in this.frameworks)
foreach (var fx in this.frameworks)
{
XElement frameworkElement = new XElement("Framework", new XAttribute("Name", fx.Name));
XDocument doc = new XDocument(
Expand Down Expand Up @@ -139,6 +139,20 @@ public void WriteToDisk (string path)
doc.WriteTo (writer);
}
}
}
}
CleanupFrameworksIndex(outputPath);
}

private void CleanupFrameworksIndex(string outputPath)
{
var files = Directory.GetFiles(outputPath);
var frameworkNames = frameworks.ToDictionary(item => item.Name, item => item);
foreach (var file in files)
{
if (!frameworkNames.ContainsKey(Path.GetFileNameWithoutExtension(file)))
{
File.Delete(file);
}
}
}
}
}
2 changes: 1 addition & 1 deletion mdoc/mdoc.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>mdoc</id>
<version>5.9.3.1</version>
<version>5.9.3.2</version>
<title>mdoc</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
Expand Down

0 comments on commit e74bcbd

Please sign in to comment.