code: public static String normalize(final String filename, final boolean unixSeparator)
      {
          final char separator = unixSeparator ? UNIX_SEPARATOR : WINDOWS_SEPARATOR;
          return doNormalize(filename, separator, true);
      }
docs: Normalizes a path, removing double and single dot path steps.
  <p>
  This method normalizes a path to a standard format.
  The input may contain separators in either Unix or Windows format.
  The output will contain separators in the format specified.
  <p>
  A trailing slash will be retained.
  A double slash will be merged to a single slash (but UNC names are handled).
  A single dot path segment will be removed.
  A double dot will cause that path segment and the one before to be removed.
  If the double dot has no parent path segment to work with, {@code null}
  is returned.
  <p>
  The output will be the same on both Unix and Windows except
  for the separator character.
  <pre>
  /foo//               -->   /foo/
  /foo/./              -->   /foo/
  /foo/../bar          -->   /bar
  /foo/../bar/         -->   /bar/
  /foo/../bar/../baz   -->   /baz
  //foo//./bar         -->   /foo/bar
  /../                 -->   null
  ../foo               -->   null
  foo/bar/..           -->   foo/
  foo/../../bar        -->   null
  foo/../bar           -->   bar
  //server/foo/../bar  -->   //server/bar
  //server/../bar      -->   null
  C:\foo\..\bar        -->   C:\bar
  C:\..\bar            -->   null
  ~/foo/../bar/        -->   ~/bar/
  ~/../bar             -->   null
  </pre>
  The output will be the same on both Unix and Windows including
  the separator character.
  
  @param filename  the filename to normalize, null returns null
  @param unixSeparator {@code true} if a unix separator should
  be used or {@code false} if a windows separator should be used.
  @return the normalized filename, or null if invalid
  @since 2.0