At compile time, how to retrieve the name of the current source file (where the code is written) in scala 2.11?
Here's a kinda hacky way that actually does the trick:
val srcFile = new Exception().getStackTrace.head.getFileName
println(srcFile)
Source: How do I get the current script or class name in Scala?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With