if path is a dir, append '/' to the path