At the moment I'm working in a team on a play! framework app.
The next user story I have to implement needs some different file modifications, e.g. move a file to a defined directory.
Because we were working on different platforms, I'm not always really sure if the app has the right path. So I want to work with a absolute path of the app directory.
How do I get the absolute path of a play! app?
Is there anywhere a method?
Play has an application path property:
String projectRoot = Play.applicationPath;
This will give you the directory that Play is running from.
I think a better practice is moving the directory outside of your project install directory and placing the path to it in your
application.conf as a property. You then retrieve it when needed. For example:
String projectRoot = Play.configuration.getProperty("my.file.path");