api / org.gradle.kotlin.dsl / SettingsScriptApi / file

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.

This method converts the supplied path based on its type:

Parameters

path - The object to resolve as a File.

Return
The resolved file.

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

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

Parameters

path - The object to resolve as a File.

validation - The validation to perform on the file.

Return
The resolved file.

See Also

KotlinSettingsScript.file