how about adding the check that make sure the last char is not Constants.PATH_SEPARATOR unless it is root?