Class Files

java.lang.Object
org.spongepowered.asm.util.Files

public final class Files extends Object
Utility class for file operations
  • Method Details

    • toFile

      public static File toFile(URL url) throws URISyntaxException
      Convert a URL to a file but handle a corner case with UNC paths which do not parse correctly.
      Parameters:
      url - URL to convert
      Returns:
      File
      Throws:
      URISyntaxException - if the URL cannot be converted to a URI
    • toFile

      public static File toFile(URI uri)
      Convert a URI to a file but handle a corner case with UNC paths which do not parse correctly.
      Parameters:
      uri - URI to convert
      Returns:
      File
    • deleteRecursively

      public static void deleteRecursively(File dir) throws IOException
      Recursively delete a directory. Does not support symlinks but this is mainly used by mixin internals which only write files and normal directories so it should be fine
      Parameters:
      dir - Root directory to delete
      Throws:
      IOException - Security errors and any other IO errors encountered are raised as IOExceptions