Bug 727551 - remove trailing slash from directories

This patch seems to address the trailing slash problem. Caveat: I am *not* a C++ guy.