Possible Duplicate:
Best way to determine if two path reference to same file in C#
So I have two Windows filenames I need to compare to determine if they are the same. One the user gave me, one given to me by another program. So how should you compare:
C:Program FilesApplication1APP.EXE C:Progra~1Applic~1APP.EXE C:program filesapplic~1app.exe
I can t seem to find a way to consistently normalize the path, I tried using Path.GetFullPath(path) and new FileInfo(path).FullName and neither seem to resolve this.
UPDATE:
Path.GetFullPath(path) will correct the short to long name conversion but it will not normalize case. Thus a StringComparer.OrdinalIgnoreCase.Equals(path1, path2) is required.