Is possible to retrieve path to the directory wher...
# scripting
i
Is possible to retrieve path to the directory where script is located? (I am talking about actual directory on disk, not working cmd directory that can be retrieved by
System.getProperty("user.dir")
)
i
There is no generic way to do it. In your custom script definition though, you can have all the info to provide a variable for your scripts from the refinement callbacks.
i
I am just starting my Kotlin scripting adventure, so can you please be more specific?
i
Kotlin scripting allow you to define a custom script "definition" with specialized handling of your scripts. This would be a jar that contains code that will be used on different stages of the compulation and evaluation. Via this customization you can add quite a lot of functionality to your scripts. Default script definitions - stadard
.kts
and extended -
.main.kts
do not provide functionality you need. Unfortunately the docs/examples are quite limited at the moment, you can have a look at the KEEP-75 (https://github.com/Kotlin/KEEP/blob/master/proposals/scripting-support.md) and repo with examples - https://github.com/Kotlin/kotlin-script-examples.