Class ProjectLogo

java.lang.Object
io.github.jbastgen.stemma.app.ui.ProjectLogo

public final class ProjectLogo extends Object
Finds the logo of a project in its working tree (feature 61). A logo the user chose for the repository (stemma.logo in the repository's configuration) wins; else the usual places are searched: a file called logo, <name>-logo, logo-<name> or <name> in the root and in the folders where logos live (logo/, img/logo/, resources/, docs/, …), and, if there is none, anywhere in the tree a few levels deep. Pictures that JavaFX can show only: PNG, JPEG, GIF and BMP (an SVG file is passed over). Pure file reading, no JavaFX: tested with folders.
  • Method Details

    • supported

      public static boolean supported(Path file)
      Whether the file is a kind of picture that is shown.
    • find

      public static Optional<Path> find(Path workTree, String name, String configured)
      The logo of a project.
      Parameters:
      workTree - the working tree
      name - the name of the repository (its folder name, as shown in the library)
      configured - the file the user chose: relative to the working tree or absolute; empty for the search
    • resolve

      public static Optional<Path> resolve(Path workTree, String configured)
      The file the user chose, if it is there and is a picture that is shown.
    • stored

      public static String stored(Path workTree, Path file)
      The text to keep in the configuration for a chosen file: relative to the working tree (with slashes) if it is inside, else absolute.