title: How to access files in the Project Directory with Grails
body: <p>I needed some templates to render some code for users to paste. I put these into </p>
  
  <pre><code>/project-dir/grails-app/resources/templates/quickInstallCode.html
  </code></pre>
  
  <p>Then I tried accessing them using their relative path (<code>grails-app/resources/templates/quickInstallCode.html</code>), and it worked great.</p>
  
  <p>When we then deployed the application to a Tomcat Server, using a .war file, the paths began pointing to a wrong location.</p>
  
  <pre><code>ERROR  call, Template file /var/lib/tomcat6/grails-app/resources/templates/quickInstallCode.html not found.
  </code></pre>
  
  <p>I assumed, that Grails, giving good defaults for everything would handle this mess for me, but it seems like it does not.</p>
  
  <p>I also tried this call, and it seemed to work great, but when deployed, the BuildSettingsHolder did not contain build Settings, which resulted in a fatal error. </p>
  
  <pre><code>BuildSettingsHolder.settings.baseDir.toString()
  </code></pre>
  
  <p><a href="http://grails.org/doc/latest/api/grails/util/BuildSettingsHolder.html" rel="nofollow">http://grails.org/doc/latest/api/grails/util/BuildSettingsHolder.html</a>
  http://grails.org/doc/latest/api/grails/util/BuildSettings.html</p>
  
  <p>I am pretty frustrated that I cannot get this easy task to work, but the reason that this is so complicated seems to be that all Files are encapsuled in a WAR and not unpacked on the Server.</p>
  
  <p>So the Questions are:</p>
  
  <ul>
  <li>Where in your Project would you put
  Files like this? </li>
  <li>How to get a
  reliable and stable way to access
  this files? I just need a stable path to a base directory, without having to hardcode something in the configuration ... This cannot be so hard.</li>
  </ul>