diff --git a/src/HUDMerger/Models/FilesHashSet.cs b/src/HUDMerger/Models/FilesHashSet.cs index 044a9e0..198ba30 100644 --- a/src/HUDMerger/Models/FilesHashSet.cs +++ b/src/HUDMerger/Models/FilesHashSet.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using System.Text.RegularExpressions; namespace HUDMerger.Models; @@ -9,9 +8,9 @@ public class FilesHashSet : HashSet { private class FilePathComparer : IEqualityComparer { - public bool Equals(string x, string y) + public bool Equals(string? x, string? y) { - return x == Encode(y); + return x == (y != null ? Encode(y) : null); } public int GetHashCode([DisallowNull] string obj) @@ -21,7 +20,7 @@ public int GetHashCode([DisallowNull] string obj) public static string Encode(string filePath) { - return String.Join('\\', Regex.Split(filePath, @"[/\\]+")); + return App.PathSeparatorRegex().Replace(filePath, "\\"); } }