From 2c82b14c476c368c98b6e081aa9f89c878e165fb Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Thu, 28 Nov 2024 15:34:59 +0800 Subject: Sort filenames when generating table of contents (#5659) The order of EnumerateFiles is unspecified --- docs/scripts/Program.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'docs/scripts') 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 nodes = new List(); foreach (var f in files) { @@ -230,4 +231,4 @@ namespace toc return outputSB.ToString(); } } -} \ No newline at end of file +} -- cgit v1.2.3