0

Is there Kotlin equivalent of scala.io.Source.fromFile()? I want to read a file located in a folder outside the module folder but still under the root project. I used to use Source.fromFile("<path-to-the-file-from-root-project>") in Scala.

err84
  • 7
  • 3
  • If you're using Kotlin/JVM, then you can use [`java.io.File`](https://stackoverflow.com/q/3844307/4161471). If you want to pass in a relative path, then the base path will depend on how you're running the program, but you can work it out with some trial an error. Instead, you could consider passing in the absolute file path as an arg, or setting an environment variable with the path, or some other way of passing in a property. – aSemy Dec 08 '22 at 08:57

0 Answers0