code: public static String addTrailingSlashIfNeeded(String directory) {
        if (StringUtils.isNullOrBlank(directory)) {
           return StringUtils.EMPTY;
        }
        int separator = indexOfLastSeparator(directory);
        String slash = SystemInfo.isUnix() ? Character.toString(UNIX_SEPARATOR) : Character.toString(WINDOWS_SEPARATOR);
        if (separator != -1) {
           slash = Character.toString(directory.charAt(separator));
        }
        return directory.endsWith(slash) ? directory : directory + slash;
     }
docs: Adds a trailing slash if its needed. Tries to determine the slash style, but defaults to unix. Assumes that what
  is passed in is a directory.
  
  @param directory The directory to possibly add a trailing slash to
  @return A directory name with a trailing slash