docs: public static String simplifyPath(String pathname) {
      checkNotNull(pathname);
      if (pathname.length() == 0) {
        return ".";
      }
  
      // split the path apart
      Iterable<String> components = Splitter.on('/').omitEmptyStrings().split(pathname);
      List<String> path = new ArrayList<String>();
  
      // resolve ., .., and //
      for (String component : components) {
        if (component.equals(".")) {
          continue;
        } else if (component.equals("..")) {
          if (path.size() > 0 && !path.get(path.size() - 1).equals("..")) {
            path.remove(path.size() - 1);
          } else {
            path.add("..");
          }
        } else {
          path.add(component);
        }
      }
  
      // put it back together
      String result = Joiner.on('/').join(path);
      if (pathname.charAt(0) == '/') {
        result = "/" + result;
      }
  
      while (result.startsWith("/../")) {
        result = result.substring(3);
      }
      if (result.equals("/..")) {
        result = "/";
      } else if ("".equals(result)) {
        result = ".";
      }
  
      return result;
    }