code: public static String getDirectoryname(final String pPath, final char pSeparator) {
          int index = pPath.lastIndexOf(pSeparator);
  
          if (index < 0) {
              return "";  // Assume only filename
          }
          return pPath.substring(0, index);
      }
docs: Extracts the directory path without the filename, from a complete
  filename path.
  
  @param pPath The full filename path.
  @param pSeparator the separator char used in {@code pPath}
  @return the path without the filename.
  @see File#getParent
  @see #getFilename