Control if there is a slash at the end of the dirPath variable