'What is the concise way of using gradle DirectoryProperty objects?

I'm upgrading from deprecated gradle properties, and instead of referencing the File jar.destinationDir, I'm using the DirectoryProperty jar.destinationDirectory

But because I need a java.nio.file.Path object, my code changes from jar.destinationDir.toPath() into jar.destinationDirectory.asFile.get().toPath()

Is there some groovy way to omit at least the .asFile.get()?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source