class AdbPathUtil {

  @NotNull
  public static String getParentPath(@NotNull String path) {
    if (StringUtil.isEmpty(path)) {
      return "";
    }
    int end = path.lastIndexOf(FILE_SEPARATOR);
    if (end == path.length() - 1) {
      end = path.lastIndexOf(FILE_SEPARATOR, end - 1);
    }
    switch(end) {
      case -1:
        return "";
      case 0:
        return FILE_SEPARATOR;
      default:
        return path.substring(0, end);
    }
  }

}