Class BaseDir


  • public abstract class BaseDir
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_BASE_DIR_MARKER_FILE_PATH
      The default name for the base dir sentinel properties file.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.nio.file.Path find()
      Finds the “directory” on the classpath that contains a file called .ratpack.
      static java.nio.file.Path find​(java.lang.String markerFilePath)
      Finds the “directory” on the classpath that contains the marker file at the given path.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_BASE_DIR_MARKER_FILE_PATH

        public static final java.lang.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 java.nio.file.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 java.nio.file.Path find​(java.lang.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