ensure that there isn't any directory seperator as the last character of the path.