Skip to content
Browse files

增加了改变默认模版的路径,如:把app/views改为templates等~

  • Loading branch information...
1 parent d9fdd73 commit 94b4c143f26f1a9d47fc5072b54338bfa0ee67b8 @arden committed
Showing with 19 additions and 6 deletions.
  1. +1 −0 Play-loader.iml
  2. +9 −1 README
  3. +1 −1 build.properties
  4. BIN lib/play-loader.jar
  5. +8 −4 src/play/modules/loader/LoaderPlugin.java
View
1 Play-loader.iml
@@ -9,6 +9,7 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ <excludeFolder url="file://$MODULE_DIR$/.idea" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
View
10 README
@@ -1,6 +1,7 @@
让Play!自动加载自己自定义的目录做为java的类加载路径,如:src目录等,目前支持play 1.2版 本。
使用方法:
+一:修改java源代码路径
1)cd <your dir>
2)play new <your project>
3)mkdir src (假设拿src目录来存放java源文件)
@@ -8,5 +9,12 @@
4)cd modules
5)git clone https://arden@github.com/arden/play-loader.git
6)修改conf/application.conf
- 增加:loader.path=src
+ 增加:javasource.path=src
7)启动项目 play run
+
+二:修改视图模版路径
+1)cd <your project>
+2)cd app
+3)mv views templates (假设把模版路径改为templates)
+4)修改conf/application.conf,增加template.path=app/templates
+5)启动项目,play run
View
2 build.properties
@@ -1 +1 @@
-play.path=D:\play-1.2RC2
+play.path=D:\play-1.2
View
BIN lib/play-loader.jar
Binary file not shown.
View
12 src/play/modules/loader/LoaderPlugin.java
@@ -11,11 +11,10 @@
* @author arden
*/
public class LoaderPlugin extends PlayPlugin {
-
public void onLoad() {
- String pattern = (String) Play.configuration.get("loader.path");
+ String pattern = (String) Play.configuration.get("javasource.path");
+ VirtualFile appRoot = VirtualFile.open(Play.applicationPath);
if (pattern != null) {
- VirtualFile appRoot = VirtualFile.open(Play.applicationPath);
String[] paths = pattern.split(",");
if (paths != null) {
for (int i = 0; i < paths.length; i++) {
@@ -25,5 +24,10 @@ public void onLoad() {
} else {
Logger.info("Missing configuration 'loader.path', loader will be ignored!");
}
+
+ pattern = (String) Play.configuration.get("template.path");
+ if (pattern != null) {
+ Play.templatesPath.add(appRoot.child(pattern));
+ }
}
-}
+}

0 comments on commit 94b4c14

Please sign in to comment.
Something went wrong with that request. Please try again.