Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I resolve a canonical filename in Windows?

If I have a string that resolves to a file path in Windows, is there an accepted way to get a canonical form of the file name?

For example, I'd like to know whether

C:\stuff\things\etc\misc\whatever.txt

and

C:\stuff\things\etc\misc\other\..\whatever.txt

actually point to the same file or not, and store the canonical form of the path in my application.

Note that simple string comparisons won't work, nor will any RegEx magic. Remember that we have things like NTFS reparse points to deal with since Windows 2000 and the new Libraries structure in Windows 7.

like image 985
dthrasher Avatar asked Nov 29 '09 20:11

dthrasher


1 Answers

GetFinalPathNameByHandle appears to do what your asking for, which is available starting with Windows Vista.

like image 157
user75810 Avatar answered Sep 25 '22 18:09

user75810