trim out the left and right slashes for paths.