public static @NotNull URI fileToUri(@NotNull File file) {
    String path = file.getAbsolutePath();
    if (File.separatorChar != '/') path = path.replace(File.separatorChar, '/');
    if (!path.startsWith("/")) path = '/' + path;
    if (path.startsWith("//")) path = "//" + path;
    try {
      return new URI("file", null, path, null);
    }
    catch (URISyntaxException e) {
      throw new IllegalArgumentException(path, e);  // unlikely, as `File#toURI()` doesn't declare any exceptions
    }
  }
public static @NotNull URI fileToUri(@NotNull File file)