NickHugi / Kotor.NET

MIT License
3 stars 1 forks source link

Add case insensitive pathing for proper cross-platform kotor support of File IO #7

Open th3w1zard1 opened 1 year ago

th3w1zard1 commented 1 year ago

This PR creates the PathHelper and PathValidator classes which have all the necessary methods to read a case-insensitive path and somewhat determine a case-sensitive path based on it. Methods are available to find case-insensitive duplicates, find the closest case-sensitive match, and validate a directory/file path. There are discrepancies in some NET versions that are accounted for here to provide some better unified support across most Unix/windows platforms. We also have a method that will find a case-sensitive path on case-insensitive systems.

The problem: KOTOR assumes a case-insensitive filesystem, but on case-sensitive filesystems there's the potential for files/directories to duplicate which KOTOR either randomly picks one or picks a specific duplicate that matches the file/directory exactly.

The solution: This PR provides the following methods in the PathHelper and PathValidator classes: