Skip to content

Commit 7ddcda2

Browse files
Normalize path separators before sorting for cross-platform consistency
Sort by forward-slash-normalized relative paths instead of raw OS paths, so file IDs are assigned identically on Windows and Linux. The remaining cross-platform hash difference is due to .NET runtime ZLib implementation differences (not fixable at application level). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a5cd999 commit 7ddcda2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

MS2Create/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,14 @@ private static (string FullPath, string RelativePath)[] GetFilesRelative(string
105105
}
106106

107107
string[] files = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories);
108-
Array.Sort(files, StringComparer.Ordinal);
109108
var result = new (string FullPath, string RelativePath)[files.Length];
110109

111110
for (int i = 0; i < files.Length; i++) {
112-
result[i] = (files[i], files[i].Remove(path));
111+
result[i] = (files[i], files[i].Remove(path).Replace('\\', '/'));
113112
}
114113

114+
Array.Sort(result, (a, b) => StringComparer.Ordinal.Compare(a.RelativePath, b.RelativePath));
115+
115116
return result;
116117
}
117118

0 commit comments

Comments
 (0)