# file

abstract fun file(path: Any): File(source)

Resolves a file path relative to the directory containing this script. This works as described for file

#### Return

The resolved file. Never returns null.

#### Since

0.9

#### Parameters

path

The object to resolve as a File.

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

Resolves a file path relative to the directory containing this script and validates it using the given scheme. See PathValidation for the list of possible validations.

#### Return

The resolved file. Never returns null.

#### Since

0.9

#### Parameters

path

An object to resolve as a File.

validation

The validation to perform on the file.

#### Throws

org.gradle.api.InvalidUserDataException

When the file does not meet the given validation constraint.