file

fun file(path: Any): File

Resolves a file path relative to this script's target base directory.

If this script targets org.gradle.api.Project, then path is resolved relative to the project directory.

If this script targets org.gradle.api.initialization.Settings, then path is resolved relative to the build root directory.

Otherwise the file is resolved relative to the script itself.

This method converts the supplied path based on its type:

Return

The resolved file.

Parameters

path

The object to resolve as a File.


fun file(path: Any, validation: PathValidation): File

Resolves a file path relative to this script's target base directory.

Return

The resolved file.

Parameters

path

The object to resolve as a File.

validation

The validation to perform on the file.

See also

KotlinInitScript.file