title: Reading files from directory in Play framework on Heroku
body: <p>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 -</p>
  
  <pre><code>val directory = Play.getFile("directory")
  for(file &lt;- directory.listFiles) {
    val lines = Source.fromFile(file).getLines()
  }
  </code></pre>
  
  <p>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 <em>directory</em> object is not getting made.</p>
  
  <p><a href="https://stackoverflow.com/questions/19089412/reading-from-a-file-in-play-on-heroku">This suggestion</a> of a similar issue suggests that I could put my directory in <em>public</em> and read it as using the <em>Play.resource</em> API. But I DONT want to put my directory in <em>public</em>. 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?</p>