PathCanonicalize is the way to go if yo want to remove ".." and "." from a path on a Windows machine. Converting a path to its canonical representation is necessary before doing any equivalence checks. Notice that PathCanonicalize does not remove any back-slashes.
PathCanonanicalize doesnt' seem to do its job...
ReplyDeleteAfter PathCanonanicalize, "c:\vegetables\potato\..\tomato" becomes "c:\vegetables\potato\tomato" (the '..' isn't intepreted as a 'go back up one directory', it's just removed). On Windows use GetFullPathName instead.