summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-11-28 15:34:59 +0800
committerGitHub <noreply@github.com>2024-11-28 15:34:59 +0800
commit2c82b14c476c368c98b6e081aa9f89c878e165fb (patch)
treef8adc4ecb020de43cb7f223e72be2ab39423eab6
parent0f3ff5f388da00188782a29a7c6706401e0e92f5 (diff)
Sort filenames when generating table of contents (#5659)
The order of EnumerateFiles is unspecified
-rw-r--r--docs/scripts/Program.cs7
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/scripts/Program.cs b/docs/scripts/Program.cs
index d543f399e..b256af1b2 100644
--- a/docs/scripts/Program.cs
+++ b/docs/scripts/Program.cs
@@ -1,7 +1,8 @@
using System;
+using System.Collections.Generic;
using System.IO;
+using System.Linq;
using System.Text;
-using System.Collections.Generic;
namespace toc
{
public class Builder
@@ -128,7 +129,7 @@ namespace toc
{
StringBuilder outputSB = new StringBuilder();
outputSB.AppendFormat("Building table of contents from {0}...\n", path);
- var files = System.IO.Directory.EnumerateFiles(path, "*.md");
+ var files = System.IO.Directory.EnumerateFiles(path, "*.md").OrderBy(f => System.IO.Path.GetFileName(f));
List<Node> nodes = new List<Node>();
foreach (var f in files)
{
@@ -230,4 +231,4 @@ namespace toc
return outputSB.ToString();
}
}
-} \ No newline at end of file
+}