Monday 2 March 2009

PathCanonicalize

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.

1 comment:

  1. PathCanonanicalize doesnt' seem to do its job...

    After 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.

    ReplyDelete