11

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.

1 Answer 1

9

The VirtualFile class should do everything you need, especially the method 'fromRelativePath()'.

VirtualFile vf = VirtualFile.fromRelativePath("filename.csv");
Sign up to request clarification or add additional context in comments.

2 Comments

is this valid for play 2.0 as well?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.