From b16cbeacb61e77c448eabca005c2ce10f363d444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 16 Aug 2020 19:10:33 +0200 Subject: [PATCH] Sort contents before merging to unify UIDs across filesystems. --- OpenRA.Game/FileSystem/Folder.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/OpenRA.Game/FileSystem/Folder.cs b/OpenRA.Game/FileSystem/Folder.cs index a258f88567..d9b9d7328e 100644 --- a/OpenRA.Game/FileSystem/Folder.cs +++ b/OpenRA.Game/FileSystem/Folder.cs @@ -12,6 +12,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; namespace OpenRA.FileSystem { @@ -32,10 +33,11 @@ namespace OpenRA.FileSystem { get { - foreach (var filename in Directory.GetFiles(path, "*", SearchOption.TopDirectoryOnly)) - yield return Path.GetFileName(filename); - foreach (var filename in Directory.GetDirectories(path)) - yield return Path.GetFileName(filename); + // Order may vary on different file systems and it matters for hashing. + return Directory.GetFiles(path, "*", SearchOption.TopDirectoryOnly) + .Concat(Directory.GetDirectories(path)) + .Select(Path.GetFileName) + .OrderBy(f => f); } }