I'm reading a few relative paths from a file and I'm searching for a function which validates them / brings them into a unified format, like this:
./file1.bin -> file1.bin
././file2.bin -> file2.bin
file3.bin -> file3.bin
folder/f/file4.bin -> folder/f/file4.bin
a/b/c/../f.bin -> a/b/f.bin
./f/../data.bin -> data.bin
./f/../../../d.bin -> d.bin
Does such a function exist in C# or would I need to write it myself? While searching I've only found functions which do that conversation relative to a "main path", i. e., converting such a relative path into an absolute one. Or functions that handle / to \ conversation but not trimming the useless "/./" or "/../" blocks.