I have the following file
/app/menus/menu1.yml
and I\'d like to read it\'s contents
--
short answer:
fileConten
From Play 2.6 this is now in Environment. And I suggest using either .getExistingFile
which returns an option in case file does not exist. Or .resource
which returns a URL to anything in the classpath only.
https://www.playframework.com/documentation/2.6.x/api/scala/index.html#play.api.Environment
class Someclass @Inject (environment: play.api.Environment) {
// ...
environment.getExistingFile("data/data.xml").fold{
// NO FILE. PANIC
}{ file =>
// Do something magic with file
}