There are lot’s of ways propagated on the internet on how to check if two given paths actually refer to the same, i.e. are identical.
That is obviously nested in the many ways one could represent the same path.
For example all of the following could actually be the same file system object:
But even if you think about normalizing paths first, that is creating absolute full qualified, redundancy free string representations and then comparing them, depending on the file system type, case or not case sensitive, you could still miss out.
Think about junctions, or (NTFS) reparse points.
Lately, I needed to do such a comparison and came up with the following function:
This function has the following traits:
The respective NativeMethods
class looks like this: