Package: grails.dev.commands.io

## [Groovy] Interface FileSystemInteraction

- Utility methods exposed to scripts for interacting with resources (found on the file system or jars) and the file system

  Authors:
    Graeme Rocher
  Since:
    3.0

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `static class` | `FileSystemInteraction.CopySpec` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `java.lang.String` | `className(Resource resource)` The class name of the given resource
    `` | `FileSystemInteraction` | `copy(groovy.lang.Closure callable)` Allows Gradle style simple copy specs
    `` | `FileSystemInteraction` | `copy(java.lang.Object path, java.lang.Object destination)` Copies a resource to the target destination
    `` | `FileSystemInteraction` | `copy(Resource from, java.io.File to)` Copy a Resource from the given location to the given directory or location
    `` | `FileSystemInteraction` | `copyAll(java.lang.Iterable resources, java.lang.Object destination)` Copies resources to the target destination
    `` | `FileSystemInteraction` | `delete(java.lang.Object path)` Deletes a file
    `` | `java.io.File` | `file(java.lang.Object path)` Obtain a file for the given path
    `` | `java.util.Collection<java.io.File>` | `files(java.lang.String pattern)` Get files matching the given pattern
    `` | `java.io.File` | `getBuildDir()` @return The target build directory
    `` | `java.io.File` | `getClassesDir()` @return The directory where classes are compiled to
    `` | `java.io.File` | `getResourcesDir()` @return The directory where resources are processed to
    `` | `FileSystemInteraction` | `mkdir(java.lang.Object path)` Makes a directory
    `` | `java.lang.String` | `projectPath(java.lang.Object path)` Obtain the path of the resource relative to the current project
    `` | `Resource` | `resource(java.lang.Object path)` Obtain a resource for the given path
    `` | `java.util.Collection<Resource>` | `resources(java.lang.String pattern)` Obtain resources for the given pattern
    `` | `Resource` | `source(java.lang.String className)` Finds a source file for the given class name

- - ### Method Detail

    - #### java.lang.String className(Resource resource)

      The class name of the given resource

      Parameters:
        `resource` - The resource
      Returns:
        The class name

    - #### FileSystemInteraction copy(@groovy.lang.DelegatesTo(CopySpec) groovy.lang.Closure callable)

      Allows Gradle style simple copy specs

      Parameters:
        `callable` - The callable
      Returns:
        this

    - #### FileSystemInteraction copy(java.lang.Object path, java.lang.Object destination)

      Copies a resource to the target destination

      Parameters:
        `path` - The path
        `destination` - The destination

    - #### FileSystemInteraction copy(Resource from, java.io.File to)

      Copy a Resource from the given location to the given directory or location

      Parameters:
        `from` - The resource to copy
        `to` - The location to copy to
      Returns:
        The {@FileSystemInteraction} instance

    - #### FileSystemInteraction copyAll(java.lang.Iterable resources, java.lang.Object destination)

      Copies resources to the target destination

      Parameters:
        `path` - The path
        `destination` - The destination

    - #### FileSystemInteraction delete(java.lang.Object path)

      Deletes a file

      Parameters:
        `path` - The path to the file

    - #### java.io.File file(java.lang.Object path)

      Obtain a file for the given path

      Parameters:
        `path` - The path
      Returns:
        The file

    - #### java.util.Collection<java.io.File> files(java.lang.String pattern)

      Get files matching the given pattern

      Parameters:
        `pattern` - The pattern
      Returns:
        the files

    - #### java.io.File getBuildDir()

      Returns:
        The target build directory

    - #### java.io.File getClassesDir()

      Returns:
        The directory where classes are compiled to

    - #### java.io.File getResourcesDir()

      Returns:
        The directory where resources are processed to

    - #### FileSystemInteraction mkdir(java.lang.Object path)

      Makes a directory

      Parameters:
        `path` - The path to the directory

    - #### java.lang.String projectPath(java.lang.Object path)

      Obtain the path of the resource relative to the current project

      Parameters:
        `path` - The path to inspect
      Returns:
        The relative path

    - #### Resource resource(java.lang.Object path)

      Obtain a resource for the given path

      Parameters:
        `path` - The path
      Returns:
        The resource

    - #### java.util.Collection<Resource> resources(java.lang.String pattern)

      Obtain resources for the given pattern

      Parameters:
        `pattern` - The pattern
      Returns:
        The resources

    - #### Resource source(java.lang.String className)

      Finds a source file for the given class name

      Parameters:
        `className` - The class name
      Returns:
        The source resource