My play framework project uses resource files like CSV files that I have under resources directory which I created under play project root directly so it is at the same level as other directories like app, public etc. From within Java or Scala files how can I open such files using path that is relative to the project root? This path should also work when I create a war and deploy the application.
Asked
Active
Viewed 3,813 times
1 Answers
9
The VirtualFile class should do everything you need, especially the method 'fromRelativePath()'.
VirtualFile vf = VirtualFile.fromRelativePath("filename.csv");
![](../../users/profiles/449856.webp)
Codemwnci
- 51,224
- 10
- 90
- 127
-
is this valid for play 2.0 as well? – harmanjd Feb 01 '13 at 16:30
-
3@harmanjd [Use Play.getExistingFile()](http://stackoverflow.com/a/12596981/1708136) – Meredith Jan 06 '14 at 19:43