Class PathUtil

java.lang.Object
com.blamejared.crafttweaker.api.util.PathUtil

public final class PathUtil extends Object
Holds various utilities related to Path manipulation.

Game directory in this context refers to the directory in which the game is set to be loaded. This means the directory containing mods, logs, and scripts.

Since:
10.0.0
  • Method Details

    • findFromGameDirectory

      public static Path findFromGameDirectory(String other)
      Resolves the given path from the current game directory.

      The given string is automatically converted into a path with the same FileSystem as the game directory.

      Parameters:
      other - The path to resolve
      Returns:
      A new Path resolving according to the given rules.
      Since:
      10.0.0
      See Also:
    • findFromGameDirectory

      public static Path findFromGameDirectory(Path other)
      Resolves the given path from the current game directory.
      Parameters:
      other - The path to resolve
      Returns:
      A new Path resolving according to the given rules.
      Since:
      10.0.0
      See Also:
    • makeRelativeToGameDirectory

      public static Path makeRelativeToGameDirectory(String other)
      Changes the given path to be relative to the current game directory.

      The given string is automatically converted into a path with the same FileSystem as the game directory.

      Parameters:
      other - The path to make relative.
      Returns:
      A new relative Path.
      Since:
      10.0.0
      See Also:
    • makeRelativeToGameDirectory

      public static Path makeRelativeToGameDirectory(Path other)
      Changes the given path to be relative to the current game directory.
      Parameters:
      other - The path to make relative.
      Returns:
      A new relative Path.
      Since:
      10.0.0
      See Also:
    • makeSameFileSystemPath

      public static Path makeSameFileSystemPath(Path original, String other)
      Creates a new path with the same underlying FileSystem as the specified one.
      Parameters:
      original - The path of which the file system should be obtained.
      other - The path to create in the file system.
      Returns:
      A new Path pointing to other with the same FS as original.
      Since:
      10.0.0
      See Also: