code: private static String determineRelativePath(String filename, String separator) {
  		if (filename.length() == 0) {
  			return "";
  		}
  
  		/*
  		 * Count the slashes in the relative filename, but exclude the leading
  		 * slash. If the path has no slashes, then the filename is relative to
  		 * the current directory.
  		 */
  		int slashCount = StringUtils.countMatches(filename, separator) - 1;
  		if (slashCount <= 0) {
  			return ".";
  		}
  
  		/*
  		 * The relative filename contains one or more slashes indicating that
  		 * the file is within one or more directories. Thus, each slash
  		 * represents a "../" in the relative path.
  		 */
  		StringBuilder sb = new StringBuilder();
  		for (int i = 0; i < slashCount; i++) {
  			sb.append("../");
  		}
  
  		/*
  		 * Finally, return the relative path but strip the trailing slash to
  		 * mimic Anakia's behavior.
  		 */
  		return StringUtils.chop(sb.toString());
  	}
docs: Determines the relative path of a filename. For each separator within the
  filename (except the leading if present), append the "../" string to the
  return value.
  
  @param filename
  The filename to parse.
  @param separator
  The separator used within the filename.
  @return The relative path of the filename. This value is not terminated
  with a forward slash. A zero-length string is returned if: the
  filename is zero-length.