I have a directory with deep structure (lot of sub-directories and files) that I read from my play application. On my PC I read the directory using -
val directory = Play.getFile("directory")
for(file <- directory.listFiles) {
val lines = Source.fromFile(file).getLines()
}
This works perfectly on my PC but not on Heroku. On Heroku I get a NPE on line#2 (above code) which means that the directory object is not getting made.
This suggestion of a similar issue suggests that I could put my directory in public and read it as using the Play.resource API. But I DONT want to put my directory in public. And I have a need to list the contents of a directory as it could be changing... how can I do this in Play on Heroku?