如何在剧中获得应用程序的真实路径

Lio*_*ion 3 playframework

这样在servlet中使用:

public void doPost(HttpServletRequest request, HttpServletResponse response)  
  throws ServletException, IOException {  
    String  filePath = config.getServletContext().getRealPath("/");  
}
Run Code Online (Sandbox Code Playgroud)

怎么在游戏中获得RealPath?

Oli*_*alo 5

玩耍就是为了轻松,对吗?所以让我们保持简单:

我使用 Play.applicationPath返回一个File.

请注意,Play类中还有一些其他很酷的路径:

  • frameworkPath
  • javaPath
  • 的templatePath