Class BaseDir


  • public abstract class BaseDir
    extends Object
    • Field Detail

      • DEFAULT_BASE_DIR_MARKER_FILE_PATH

        public static final String DEFAULT_BASE_DIR_MARKER_FILE_PATH
        The default name for the base dir sentinel properties file.

        Value: ".ratpack"

        See Also:
        find(), Constant Field Values
    • Method Detail

      • find

        public static Path find()
        Finds the “directory” on the classpath that contains a file called .ratpack.

        Calling this method is equivalent to calling findBaseDir(".ratpack").

        Returns:
        a base dir
        See Also:
        find(String)
      • find

        public static Path find​(String markerFilePath)
        Finds the “directory” on the classpath that contains the marker file at the given path.

        The classpath search is performed using ClassLoader.getResource(String) using the current thread's context class loader.

        If the resource is not found, an IllegalStateException will be thrown.

        If the resource is found, the enclosing directory of the resource will be converted to a Path and returned. This allows a directory within side a JAR (that is on the classpath) to be used as the base dir potentially.

        Parameters:
        markerFilePath - the path to the marker file on the classpath
        Returns:
        the base dir