Class PathBuilder

    • Method Detail

      • getPathBuilder

        public static PathBuilder getPathBuilder()
        Returns an instance of PathBuilder with all checks enabled (recommended).
        Returns:
      • buildPath

        public String buildPath​(String... args)
                         throws IOException

        Builds a path from the passed argument strings. This path will be compatible with the local filesystem.

        If the args contain variables enclosed in square brackets ([ ]), they will be replaced with values in the built path. There are several built-in variables available, listed below. Any text between square brackets that does not match these will be replaced by a matching System environment variable if one is available.

        Built-in variables include:

        • [tmp] An available temp directory (Java Temp directory, c:\\temp, $TMPDIR, %TEMP%, etc.)
        • [user] The OS user directory (~, user.home, etc)

        This method will run several checks by default to ensure that the built path does not point to unintended areas of the filesystem. If these checks are violated, a RuntimeException will be thrown. If needed in special cases, the behavior of these checks can be modified via the linked fluent constructor methods below.

        Parameters:
        args - entries with which to construct the filesystem path
        Returns:
        a local filesystem path
        Throws:
        RuntimeException
        IOException