Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Support for play application path #7

Merged
merged 1 commit into from

2 participants

@oporkka

Added support for Play application path variable to enable Play messages to work if Play has been started using the app_path parameter.

@oporkka

What do you think about this one? Could it be pulled?

@huljas huljas merged commit f9bc7d5 into huljas:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 29, 2011
  1. @oporkka
This page is out of date. Refresh to see the latest.
View
4 src/play/modules/messages/DefaultMessagesResource.java
@@ -18,7 +18,9 @@
File targetDir;
public DefaultMessagesResource() {
- targetDir = new File(Play.configuration.getProperty("messages.targetDir", "conf"));
+ String applicationPath = Play.applicationPath.getPath();
+ String separator = System.getProperty("file.separator");
+ targetDir = new File(applicationPath + separator + Play.configuration.getProperty("messages.targetDir", "conf"));
}
@Override
View
7 src/play/modules/messages/SourceKeys.java
@@ -7,6 +7,7 @@
import java.io.File;
import java.io.FileReader;
+import java.io.FilenameFilter;
import java.io.IOException;
import java.util.*;
import java.util.regex.Pattern;
@@ -22,9 +23,13 @@ public static SourceKeys lookUp() {
SourceKeys foundKeys = new SourceKeys();
MessageKeyMatcher matcher = new MessageKeyMatcher();
String s = Play.configuration.getProperty("messages.srcDir", "app");
+
String[] paths = s.split(Pattern.quote(","));
+ String applicationPath = Play.applicationPath.getPath();
+ String separator = System.getProperty("file.separator");
+
for (String path : paths) {
- Iterator<File> iterator = FileUtils.iterateFiles(new File(path), new String[]{"java", "html", "js"}, true);
+ Iterator<File> iterator = FileUtils.iterateFiles(new File(applicationPath + separator + path), new String[]{"java", "html", "js"}, true);
while (iterator.hasNext()) {
try {
File file = iterator.next();
Something went wrong with that request. Please try again.